So, now that I have setup as a backup GIT repo to, I needed a simple way to always push to both repos – best way for me is to always hook into my regular work flow, otherwise I’d just forget. The git-remote(1) man page to the rescue, it describes the set-url --add sub-command:

git remote set-url --add origin ssh://

Now, with a simple git push followed by git push --tags I had now pushed to both the GitHub repo as well as my own server!

Obviously I don’t use port 1234, but that’s the syntax if you want to push to a GIT server over SSH on a different port than the default (22).

You can of course just edit the .git/config file instead, which in many cases might be faster:

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

Of course I first had to create the empty watchdogd.git on the server. I do this quite often, so I’ve wrapped it in a script:

cd /srv/git
git init --bare watchdogd.git
echo "Refurbished watchdog daemon from uClinux-dist" >watchdogd.git/description

To inspect your current push/pull repos, issue git remote -v:

origin (fetch)
origin (push)
origin	ssh:// (push)