Skip to content

Create a push mirror

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

Creates a push mirror.

id
required
One of:
string

The ID or URL-encoded path of the project

Media type application/json
object
url
required

The URL for a remote mirror

string
nullable
Example
https://*****:*****@example.com/gitlab/example.git
enabled

Determines if the mirror is enabled

boolean
nullable
auth_method

Determines the mirror authentication method

string
nullable
Allowed values: ssh_public_key password
keep_divergent_refs

Determines if divergent refs are kept on the target

boolean
nullable
only_protected_branches

Determines if only protected branches are mirrored

boolean
nullable
mirror_branch_regex

Determines if only matched branches are mirrored

string
nullable
host_keys

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.

Array<string>
nullable

Created

Media type application/json
object
id
integer format: int64
enabled
boolean
url
string
update_status
string
last_update_at
string format: date-time
last_update_started_at
string format: date-time
last_successful_update_at
string format: date-time
last_error
string
only_protected_branches
boolean
keep_divergent_refs
boolean
auth_method
string
host_keys
Array<object>
object
fingerprint_sha256
string
mirror_branch_regex
string
Example
{
"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-.*"
}

Bad request

Unauthorized

Not found