I want to change the Gitlab mirroring settings for each of my repositories. Is it possible to do this over the Gitlab API?
The options the Gitlab WebUi allows, are the following:
How can I change them via the API?
Remark: This is not the same question as "How can I tell Gitlab to mirror my Github repositories over the API?" as there my question was how to start the mirroring, here I want to know how I can change the mirroring settings.
On https://docs.gitlab.com/ee/api/projects.html#edit-project there are several parameters to configure the pull mirroring:
Notice that Push mirroring is not yet implemented: https://gitlab.com/gitlab-org/gitlab-ee/issues/7599
I have put my script here if anyone searches for it: https://github.com/SeppPenner/GitlabAutoPullMirroring (mirrored here: https://gitlab.com/SeppPenner/GitlabAutoPullMirroring)
I could never find an API endpoint for the mirroring URL. You can kinda, sorta hack this through the database but I couldn't figure out how to obscure the remote login token I was using (for BitBucket) from the database. When you go through the web interface it must encrypt it or put it someplace other than import_url. Anyway, here are things I changed to establish mirroring for some new projects. You do this from the gitlab-psql console.
Again, just want to repeat that the URL, including password, will be exposed in the DB and you probably don't want that long-term. In my case I was doing an initial import of over 100 repos from BitBucket where we intended the mirroring to be shut off in a couple weeks.
You'll need the GitLab project ID.
Notes: