remote_mirrors

Create a push mirror

Creates a push mirror.

post/api/v4/projects/{id}/remote_mirrors

Request

  • Base URL
    https://gitlab.com
  • Auth
    none declared

Path parameters

idstring required

The ID or URL-encoded path of the project

Request body

urlstring required

The URL for a remote mirror

enabledboolean

Determines if the mirror is enabled

auth_method'ssh_public_key' | 'password'

Determines the mirror authentication method

keep_divergent_refsboolean

Determines if divergent refs are kept on the target

only_protected_branchesboolean

Determines if only protected branches are mirrored

mirror_branch_regexstring

Determines if only matched branches are mirrored

host_keysstring[]

SSH host keys in bare format (ssh-ed25519 AAAA...) or full known_hosts format (hostname ssh-ed25519 AAAA...). Bare keys use the hostname from the mirror URL.

Example request

{
  "url": "https://*****:*****@example.com/gitlab/example.git"
}

Response

Create a push mirror

idinteger required
enabledboolean required
urlstring required
update_statusstring required
last_update_atstring date-time required
last_update_started_atstring date-time required
last_successful_update_atstring date-time required
last_errorstring required
only_protected_branchesboolean required
keep_divergent_refsboolean required
auth_methodstring required
mirror_branch_regexstring required

Example response

{
  "id": 101486,
  "enabled": true,
  "url": "https://*****:*****@example.com/gitlab/example.git",
  "update_status": "finished",
  "last_update_at": "2020-01-06T17:32:02.823Z",
  "last_update_started_at": "2020-01-06T17:32:02.823Z",
  "last_successful_update_at": "2020-01-06T17:31:55.864Z",
  "last_error": "The remote mirror URL is invalid.",
  "auth_method": "password",
  "host_keys": [
    {
      "fingerprint_sha256": "SHA256:abcd1234"
    }
  ],
  "mirror_branch_regex": "feature-.*"
}

Changes

No recorded changes to this operation across all 5 revisions of this API.