We have an internal Git server and use Github.com however I am confused on how to sync my repo to both github.com and our internal git server, is this even possible?
I heard something about git remotes but i am not sure how to set that up
Add a remote using the git remote
command, for example, git remote add github [email protected]:user/repo.git
.
If you want to push separately, you're set. If you'd like to have git push
push to multiple remotes, you can setup your .git/config
as shown in this answer. In short, you rename your current origin
remote, and create a new origin which contains multiple url entries and no fetch entry, then configure your branches to pull from whichever source you consider authoritative.
You can use a non-origin remote for the combined push if you'd like to have that functionality, but don't want it to be the default behavior.
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