프로젝트 원격 미러 API

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated

프로젝트의 리포지터리 설정에서 정의된 “원격 미러”는 원격 미러 API로 상태를 조회하거나 수정할 수 있습니다.

보안상의 이유로 API 응답의 url 속성은 항상 사용자 이름 및 비밀번호 정보가 삭제됩니다.

note
풀 미러다른 API 엔드포인트를 사용하여 표시 및 업데이트됩니다.

프로젝트의 원격 미러 디렉터리

원격 미러 및 상태의 배열을 반환합니다:

GET /projects/:id/remote_mirrors

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/42/remote_mirrors"

예시 응답:

[
  {
    "enabled": true,
    "id": 101486,
    "auth_method": "ssh_public_key",
    "last_error": null,
    "last_successful_update_at": "2020-01-06T17:32:02.823Z",
    "last_update_at": "2020-01-06T17:32:02.823Z",
    "last_update_started_at": "2020-01-06T17:31:55.864Z",
    "only_protected_branches": true,
    "keep_divergent_refs": true,
    "update_status": "finished",
    "url": "https://*****:*****@gitlab.com/gitlab-org/security/gitlab.git"
  }
]

단일 프로젝트의 원격 미러 가져오기

원격 미러 및 상태를 반환합니다:

GET /projects/:id/remote_mirrors/:mirror_id

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/42/remote_mirrors/101486"

예시 응답:

{
  "enabled": true,
  "id": 101486,
  "last_error": null,
  "last_successful_update_at": "2020-01-06T17:32:02.823Z",
  "last_update_at": "2020-01-06T17:32:02.823Z",
  "last_update_started_at": "2020-01-06T17:31:55.864Z",
  "only_protected_branches": true,
  "keep_divergent_refs": true,
  "update_status": "finished",
  "url": "https://*****:*****@gitlab.com/gitlab-org/security/gitlab.git"
}

풀 미러 생성

Projects API를 사용하여 풀 미러를 구성하는 방법을 알아보세요.

푸시 미러 생성

푸시 미러는 기본적으로 비활성화되어 있습니다. 활성화하려면 미러 생성시 선택적 매개변수 enabled를 포함하십시오:

POST /projects/:id/remote_mirrors
속성 유형 필수 설명
url String yes 리포지터리가 미러링되는 대상 URL입니다.
enabled Boolean no 미러가 활성화되어 있는지 여부를 결정합니다.
keep_divergent_refs Boolean no 발산 참조가 건너뛰어지는지 여부를 결정합니다.
only_protected_branches Boolean no 보호된 브랜치만 미러링되는지 여부를 결정합니다.
mirror_branch_regex String no 정규 표현식을 포함합니다. 정규식과 일치하는 브랜치만 미러링됩니다. only_protected_branches를 비활성화해야 합니다. Premium 및 Ultimate 전용입니다.
auth_method String no 미러의 인증 방법을 결정합니다 (ssh_public_key 또는 password).

예시 요청:

curl --request POST --data "url=https://username:token@example.com/gitlab/example.git" \
     --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/42/remote_mirrors"

예시 응답:

{
    "enabled": false,
    "id": 101486,
    "auth_method": "password",
    "last_error": null,
    "last_successful_update_at": null,
    "last_update_at": null,
    "last_update_started_at": null,
    "only_protected_branches": false,
    "keep_divergent_refs": false,
    "update_status": "none",
    "url": "https://*****:*****@example.com/gitlab/example.git"
}

원격 미러의 속성 업데이트

  • 필드 auth_method는 GitLab 16.10에 도입됨.

원격 미러를 켜거나 끄거나, 또는 미러링하는 브랜치 유형을 변경합니다:

PUT /projects/:id/remote_mirrors/:mirror_id
속성 유형 필수 설명
mirror_id Integer yes 원격 미러 ID입니다.
enabled Boolean no 미러가 활성화되어 있는지 여부를 결정합니다.
keep_divergent_refs Boolean no 발산 참조가 건너뛰어지는지 여부를 결정합니다.
only_protected_branches Boolean no 보호된 브랜치만 미러링되는지 여부를 결정합니다.
mirror_branch_regex String no 정규식과 일치하는 브랜치만 미러링됩니다. only_protected_branches가 활성화된 상태에서는 작동하지 않습니다. Premium 및 Ultimate 전용입니다.
auth_method String no 미러의 인증 방법을 결정합니다 (ssh_public_key 또는 password).

예시 요청:

curl --request PUT --data "enabled=false" --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/42/remote_mirrors/101486"

예시 응답:

{
    "enabled": false,
    "id": 101486,
    "auth_method": "password",
    "last_error": null,
    "last_successful_update_at": "2020-01-06T17:32:02.823Z",
    "last_update_at": "2020-01-06T17:32:02.823Z",
    "last_update_started_at": "2020-01-06T17:31:55.864Z",
    "only_protected_branches": true,
    "keep_divergent_refs": true,
    "update_status": "finished",
    "url": "https://*****:*****@gitlab.com/gitlab-org/security/gitlab.git"
}

원격 미러 삭제

원격 미러를 삭제합니다.

DELETE /projects/:id/remote_mirrors/:mirror_id
속성 타입 필수 설명
mirror_id Integer yes 원격 미러 ID.

예시 요청:

curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/42/remote_mirrors/101486"