Starting the synchronization of the remote mirror via API

Hi all!

I have two GitLab CE servers (v14) on two different machines. One is primary = gitlab1. The other (=gitlab2) is for “backup”. I hope I will never need it. The first (=primary) GitLab server has other backups too!!

Today I created a script thats “copies” the group / subgroup / project structure of the gitlab1 to the gitlab2. Using the API v4.

Than it adds a special member to each project on “gitlab2”.

Than the script adds a remote mirror to each project on “gitlab1” pointing to the project on “gitlab2”.

Thats all fine. It works.

But the remote mirror sync does not get started. There seems to be no way to start the sync by using the API. - I can start it on the Web GUI. But I habe some 100 of projects… I’d like to sync them once automatically.

Any idea?


Hi Ingo,

I had the same challenge as you. I could not find an API that mimicked the “Update now” button in the mirroring UI.

My workaround was to create a dummy tag on any branch in the repository and then delete the tag. This caused the push mirror operation to run.

I hope this helps,

  • Steve

Hi Steve! Thank you for your answer! - Meanwhile I created a script with some web requests that “simulate” the click on “Update now”. That works. Therefore I need a personal access token that is embedded in the script… - Regards, Ingo