Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I sync my repository to both GitHub and my internal Git server?

Tags:

git

github

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

like image 824
user2038261 Avatar asked Jun 17 '13 16:06

user2038261


1 Answers

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.

like image 120
cjc343 Avatar answered Oct 15 '22 05:10

cjc343