I have a number of Gitlab projects that I'd also like to store as repos in Github. How can I initialize a new Github repo for a project with an existing Gitlab git config?
I read this on mirroring/moving repos, but I don't want to move anything per se, I just want to have the project exist on both Github and Gitlab.
And if I do have a local project with both a Gitlab and Github git
config, how can I specify which to push changes to? How would I specify to perhaps push changes to both at the same time?
This is to say you want to be able to deploy to multiple remote repositories if that's the case
To add new repo's run this command
git remote add < shortname > < url >
git remote add origin-new [email protected]:username/repo-name.git
where:
origin-new is the remote server name (it can be any valid string)
[email protected]:username/repo-name.git is the url to your online repo
To Show Your Remotes
$ git remote -v
origin https://gitlab.com/username/repo-name (fetch)
origin https://gitlab.com/username/repo-name (push)
origin-new https://github.com/username/repo-name (fetch)
origin-new https://github.com/username/repo-name (push)
Pushing to Your Remotes
git push < remote > < branch >
$ git push origin master
$ git push origin-new dev
Fetching and Pulling from Your Remotes
git pull < remote >
git fetch < remote >
$ git pull origin
$ git pull origin-new
for more checkout out Git Basics Working with Remotes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With