Problems with triggering pull mirroring proces from API

Hi there,

I’m having some trouble with triggering a mirror pull using the gitlab API. The idea is to let Bitbucket call a webhook to notify gitlab when to mirror the repo. I’ve been following this resource:
https://docs.gitlab.com/ee/ci/ci_cd_for_external_repos/bitbucket_integration.html

Unfortunately, I’m not able to proceed because of the following error I received from the API.

{ "message": "The project is not mirrored" }

I’ve set up a bitbucket webhook on push like this: https://gitlab.com/api/v4/projects/xxxxxx/mirror/pull?private_token=xxxxxxxx using POST

The docs are unclear on how to deal with api errors related to the /projects/xxxxxx/mirror/pull endpoint. Here is the link to the docs.

Right now I have no idea how to continue or solve this error. I’ve scoured all the docs, used advanced search to look for that error message but I haven’t found any resource or others struggling with the same problem.

I’ve also looked through all of the settings in gitlab to see if I missed any configuration.

Could anyone help me in the right direction?

1 Like

I’m having the same issue and the process to mirror the repo using the API is really unclear. Were you able to solve your problem?

I’ll paste here the solution, this was confirmed not only by me but by a gitlab developer:

curl -X PUT \
--url https://gitlab.com/api/v4/projects/<migrated-gitlab-repo-ID> \
--header 'Content-Type: application/json' \
--header 'Authorization: <gitlab-token>' \
--data '{"mirror": true, "import_url":"https://<gitlhub-user>:<github-token>@github.com/<org-name-id>/<repo- name>.git"}'
1 Like