DEV Community

Cover image for Github and Gitlab sync

Github and Gitlab sync

Bruno Robert on March 21, 2021

Both Github and Gitlab are great ways to host your git repositories online. They both have great tools to manage your project, be it open source or...
Collapse
 
hfgestaopublica profile image
hfgestaopublica

If you want to use both GitHub and GitLab:

git remote add github <your-github-url> # create a remote for GitHub
git remote add gitlab <your-gitlab-url> # create another remote for GitLab
git push -u github <local_branch_name> # set the default upstream to GitHub

If you want to change your remote URL from GitLab to GitHub:

git remote set-url origin <your-github-url> # use GitHub as your (only) origin

Collapse
 
maresb profile image
Ben Mares

Warning: Your git push http://... command should instead use https!

Collapse
 
brunorobert profile image
Bruno Robert

nice catch

Collapse
 
dfarruh profile image
Danieler Farruh

I tried repo -> settings -> repository -> repository mirroring, for which i found the documentation in the gitlab doc, but i'm getting this error:

remote Support for password authentication was removed on August 13, 2021

for this error I found a blogpost here. Is there no better way to mirror repos nowadays than to clone and then push all of them?

Collapse
 
iulian35038342 profile image
iulian

In github action:

uses: wangchucheng/git-repo-sync@v0.1.0

is this gitlab or github username and version?

Collapse
 
stardustman profile image
stardust

gitlab

Collapse
 
zscoder profile image
Zubin Shah

From where to get the version of the project

Collapse
 
teddblue profile image
teddblue • Edited

For the TARGET_TOKEN variable in method 1 github to gitlab, is the token the Personal or project access token?

Collapse
 
mochadwi profile image
Mochamad Iqbal Dwi Cahyo

I'm using Personal in this case, not sure if there Project Access Token

Collapse
 
wahyudotdev profile image
Wahyu Hidayat

Thanks a lot, work like a charm

Collapse
 
creeki profile image
Yuqi

Thanks a lot!