Depending on who I work with, I get request sometime to push code not only to my working github account also the clients account. I’m using the Github client to update from my local machine to the Github repository, what do you do if you need to push code to another source code control system.
I will explain what I did to make this work for me, I like client tools to SaaS service, I’m not that keen on using the command line to do all the administrative work for Git.
This is my Github client
All I did was to edit the .git/config in the source code folders that is under my Github control, what I did was adding another line url = as shown in this picture
all the other config values are set by the Github client on install, I just added one line. This works for me, if you love the command line you could do the following.
You can put the following in the
[remote "both"] url = url/to/first/remote url = url/to/other/remote
You can now push to both urls using
git push both.
If you also want to fetch from them (useful for sync) you may add the following lines in your
[remotes] both = origin, other
Now you can also run
git fetch both
I would not recommend fetching from both, I would use one repro for backup purposes only so a push is enough to the backup repro.
Another way to do this is to do the following commands on the command line.
$ git remote -v origin [email protected]:something.git (fetch) origin [email protected]:something.git (push) my_other_remote git://somewhere/something.git (fetch) my_other_remote git://somewhere/something.git (push)
You could do:
git remote set-url --add --push origin git://somewhere/something.git
git push origin
will push to both repositories. You might want to set up a new remote called both for this, however, to avoid confusion. For example:
git remote add both [email protected]:something.git git remote set-url --add --push both git://somewhere/something.git
git push both
… will try to push to both repositories.
Have comments use the comment box below.