Skip to content

Synchronization of GitLab & GitHub Repositories

Chris Dedman-Rollet edited this page Feb 20, 2024 · 3 revisions

Configuration for mirroring GitHub and GitLab repository from your local terminal. Assuming you have two repositories ready on GitHub and GitLab.

1. git clone https://github.com/<username>/<repo>.git
2. git remote add gitlab https://gitlab.com/<username>/<repo>.git

3. Set origin to pull on one remote url
  3.1 git remote rename origin github
  3.2 git remote add origin https://github.com/<username>/<repo>.git

4. Set origin to push on both remote url
  4.1 git remote set-url --add origin https://github.com/<username>/<repo>.git
  4.2 git remote set-url --add origin https://gitlab.com/<username>/<repo>.git

5. git push origin

Now, every time you do any modification from your local machine, add -> commit -> git push origin and the changes will be pushed to both GitHub and GitLab simultaneously.

Clone this wiki locally