Git Two Remote
When using GitLab for private use, you also sometimes would like to upload the same code to GitHub as well. In this example, we clone a repo from GitLab and mirror the same thing to GitHub.
1. Cloning GitLab
For example, we have a repo in GitLab http://git.boanlab.com/boanlab/solution
This is a private repo, so you will not have an access to this.
git clone http://git.boanlab.com/boanlab/solution.git
2. Adding Remote
For example, we also have a repo in GitHub to mirror this one https://github.com/isu-kim/boanlab-solution
git remote add github https://github.com/isu-kim/boanlab-solution.git
3. Push GitHub
Be aware, GitHub has base branch named
main
notmaster
.
git push github main
This will push the code which was cloned from GitLab to GitHub.
Last updated