13

Is it possible to mirror a git repository (sync across all hosts) on GitHub, SourceForge and Google Code given they all support git?

Mat Kelly
  • 2,327
  • 7
  • 29
  • 51
Vasant
  • 301
  • 4
  • 14
  • I assume you want them to stay in sync more or less automagically? Would you be committing to all of them, or just one (or none of them)? – Roman Mar 21 '13 at 00:09
  • @R0MANARMY Yes I'm going to commit only one repo thats it, that commit should sync with all other repo hosted on different servers like I mentioned. – Vasant Mar 21 '13 at 17:44

1 Answers1

11

You can edit your .git/config file to create a remote that pushes to multiple repositories.

[remote "everyone"]
    url = https://github.com/USERNAME/REPOSITORY.git
    url = ssh://USERNAME@git.code.sf.net/p/PROJECTNAME/MOUNTPOINT
    url = https://PROJECT.googlecode.com/git

or with the git config --add command:

git config --add remote.everyone.url https://github.com/USERNAME/REPOSITORY.git
git config --add remote.everyone.url ssh://USERNAME@git.code.sf.net/p/PROJECTNAME/MOUNTPOINT
git config --add remote.everyone.url https://PROJECT.googlecode.com/git

Now when you type git push everyone master, you'll push the master branch to all three remotes.

Thanks to this Stack Overflow answer for the clue.

Community
  • 1
  • 1
Stephen Jennings
  • 12,494
  • 5
  • 47
  • 66