reverse engineered

git multiple remotes

git has a very undocumented feature which allows you to group multiple remote URLs as a single remote.

This allows you to push to many remote branches in a single command. I prefer using gitweb to browse my repositories, so I push to my own server, but I know that other people like using github, so I may as well push there as well.

To add multiple remote URLs, edit the .git/config file in the repository and add a second (or more) url line.

[remote "origin"]
        url =
        url =
        fetch = +refs/heads/*:refs/remotes/origin/*

Now I can push to both my own server and to github using

git push origin

comments powered by Disqus