Commit 44e4b4e5 authored by Katrin Leinweber's avatar Katrin Leinweber Committed by Russell Dickenson

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

parent f3330498
......@@ -2678,13 +2678,21 @@ Read more in the [Project members](members.md) documentation.
> - Introduced in GitLab 11.
> - 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.
The relevant API parameters to update are:
- `import_url`: URL of remote repository being mirrored (with `username:password` if needed).
- `mirror`: Enables pull mirroring on project when set to `true`.
- `only_mirror_protected_branches`: Set to `true` for protected branches.
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:token` authentication.
In case your HTTP repository is not publicly accessible,
you can add the authentication information to the URL:
`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)**
......
......@@ -51,11 +51,15 @@ NOTE:
For security reasons, the `url` attribute is always scrubbed of username
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.
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
POST /projects/:id/remote_mirrors
......@@ -63,7 +67,7 @@ POST /projects/:id/remote_mirrors
| 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. |
| `only_protected_branches` | Boolean | no | Determines if only protected branches are mirrored. |
| `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