5

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

user2038261
  • 85
  • 1
  • 3
  • 1
    you have to setup a remote branch one for github and one for your own internal server. Just like what you do if you host your application in heroku. – uday Jun 17 '13 at 16:23
  • How is your internal git server set up? Can you get shell access? Do you access it via gitolite? – gcbenison Jun 17 '13 at 16:53

2 Answers2

7

Add a remote using the git remote command, for example, git remote add github git@github.com: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.

Community
  • 1
  • 1
cjc343
  • 3,735
  • 1
  • 29
  • 34
  • 1
    It was true in 2013, I just want to confirm that it is still the best way to achieve this that came out after 5 years of Git. – Juliatzin Mar 26 '19 at 09:15
0

First clone repository into you system via github.It will provide automatically after you login with github.Then start cloning.Then you can start work from your cloning location's project. Just push and pull your changes.

You can learn more about github from here Branching and Merging

Ponting
  • 2,248
  • 8
  • 33
  • 61