Commit 25bec1d8 authored by Russell Dickenson's avatar Russell Dickenson

Merge branch '294424-repair-pull-mirroring-api-docs' into 'master'

Resolve "Configuring pull mirroring from GitHub.com to GitLab.com via API returns error"

See merge request gitlab-org/gitlab!71189
parents 8a68dab4 44e4b4e5
...@@ -2678,13 +2678,21 @@ Read more in the [Project members](members.md) documentation. ...@@ -2678,13 +2678,21 @@ Read more in the [Project members](members.md) documentation.
> - Introduced in GitLab 11. > - Introduced in GitLab 11.
> - Moved to GitLab Premium in 13.9. > - Moved to GitLab Premium in 13.9.
Configure pull mirroring while [creating a new project](#create-project) or [updating an existing project](#edit-project) using the API if the remote repository is publicly accessible or via `username/password` authentication. In case your HTTP repository is not publicly accessible, you can add the authentication information to the URL: `https://username:password@gitlab.company.com/group/project.git`, where password is a [personal access token](../user/profile/personal_access_tokens.md) with the API scope enabled. Configure pull mirroring while [creating a new project](#create-project)
or [updating an existing project](#edit-project) using the API
The relevant API parameters to update are: if the remote repository is publicly accessible
or via `username:token` authentication.
- `import_url`: URL of remote repository being mirrored (with `username:password` if needed). In case your HTTP repository is not publicly accessible,
- `mirror`: Enables pull mirroring on project when set to `true`. you can add the authentication information to the URL:
- `only_mirror_protected_branches`: Set to `true` for protected branches. `https://username:token@gitlab.company.com/group/project.git`,
where `token` is a [personal access token](../user/profile/personal_access_tokens.md)
with the API scope enabled.
| Attribute | Type | Required | Description |
|--------------|---------|------------------------|-------------|
| `import_url` | string | **{check-circle}** Yes | URL of remote repository being mirrored (with `user:token` if needed). |
| `mirror` | boolean | **{check-circle}** Yes | Enables pull mirroring on project when set to `true`. |
| `only_mirror_protected_branches`| boolean | **{dotted-circle}** No | Limits mirroring to only protected branches when set to `true`. |
## Start the pull mirroring process for a Project **(PREMIUM)** ## Start the pull mirroring process for a Project **(PREMIUM)**
......
...@@ -51,11 +51,15 @@ NOTE: ...@@ -51,11 +51,15 @@ NOTE:
For security reasons, the `url` attribute is always scrubbed of username For security reasons, the `url` attribute is always scrubbed of username
and password information. and password information.
## Create a remote mirror ## Create a pull mirror
Learn how to [configure a pull mirror](projects.md#configure-pull-mirroring-for-a-project) using the Projects API.
## Create a push mirror
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/24189) in GitLab 12.9. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/24189) in GitLab 12.9.
Create a remote mirror for a project. The mirror is disabled by default. You can enable it by including the optional parameter `enabled` when creating it: Push mirroring is disabled by default. You can enable it by including the optional parameter `enabled` when creating it:
```plaintext ```plaintext
POST /projects/:id/remote_mirrors POST /projects/:id/remote_mirrors
...@@ -63,7 +67,7 @@ POST /projects/:id/remote_mirrors ...@@ -63,7 +67,7 @@ POST /projects/:id/remote_mirrors
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
| :---------- | :----- | :--------- | :------------ | | :---------- | :----- | :--------- | :------------ |
| `url` | String | yes | The URL of the remote repository to be mirrored. | | `url` | String | yes | The target URL to which the repository is mirrored. |
| `enabled` | Boolean | no | Determines if the mirror is enabled. | | `enabled` | Boolean | no | Determines if the mirror is enabled. |
| `only_protected_branches` | Boolean | no | Determines if only protected branches are mirrored. | | `only_protected_branches` | Boolean | no | Determines if only protected branches are mirrored. |
| `keep_divergent_refs` | Boolean | no | Determines if divergent refs are skipped. | | `keep_divergent_refs` | Boolean | no | Determines if divergent refs are skipped. |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment