How to push to two servers at once with git

As I said this time last year, I dislike the idea of people using a decentralised version control system to centralise their code.

This means that some of my code sits in Bazaar on my server, some in Git on my server, and some in github. I’m not keen on this situation, and given that github does have a large amount of mindshare, and that launchpad is really quite horrible to use, I want to be able to “git push” to both my server and github at the same time.

It turns out this is quite easy; and everything below (with a few very minor modifications) comes from “Setting up a new remote git repository” by Tim Lucas and Aristotle Pagaltzis‘ answer on this Stackoverflow question.

So, given that I have a working github repo, and a local checkout:

Set up the new bare repo on the server:

$ ssh
$ mkdir /var/git/myapp.git
$ cd /var/git/myapp.git
$ git --bare init
Initialized empty Git repository in /var/git/myapp.git
$ exit

Add the remote repository to your existing local git repo and push:

$ cd ~/code/myapp
$ git remote add myserver ssh://
$ git push myserver master

You have now associated the remote repo with your local repo under the name “myserver”. Now open up ~/code/myapp/.git/config and:

put something like this:

[remote "public"]
    url =
    url = ssh://

Now you can say “git push public” to push to both repos at once.

and that’s it! Every time you push you will be making sure that your code lives on both your server and on github. Adds links to both in your README and the job is complete.

Bazaar and Git

I’ve had cause to use both Bazaar and Git recently, which are very similar to one another and both of which I quite like.

Git seems slightly slicker, and gives me nicely colourised output, which I’m a sucker for. Then of course there’s GitHub, which is a very appealing way of easily publishing your code, forking and so on. All of these mean I’ll probably use it in the future.

The command set of Bazaar feels more natural to me, which I miss a lot in Git. Its parameters for seemingly simple tasks are comparatively obscure, and to this newbie, poorly explained by the command-line help, a consequence of which is that I have found the GitHub guides invaluable. Also, I always forget that in Ubuntu running sudo apt-get install git will not actually install git, but “GNU Interactive Tools, a file browser/viewer and process viewer/killer” (it’s sudo apt-get install git-core, for reference!).

There’s some interesting commentary on revision control systems as a whole, and the git command set in particular on Revision Control Systems suck and the series of posts he links to.


bzr get

wxVenus is, at the moment, a desktop tool for browsing the cache that a local Venus installation creates when it runs. It is written in wxPython and is dependent on lxml.


It is also the first Python program of greater than ten lines that I’ve ever written, and given that we’ve already established I am very bad at it, the code quality is very low.

The long-term intention is to provide a cross-platform desktop tool which uses either a local or remote Venus installation as its aggregator and data source. At the moment I am using Lighthouse to track progress, but the free account doesn’t let me expose my tickets publically (although I will use the API to do this) I’ve moved to Google code because Lighthouse was closed and my local Trac install was slower than you could possibly imagine.

Really this is a lesson in Bazaar, Python, wxWidgets and XML parsing. Hopefully I will end up with a tool I can use. So far I’m learning a lot 🙂