Yesterday, with the return of my family from holiday, I forgot to make changes to any of my projects in GitHub, and broke my commit streak at 57 days.
Initially I’d aimed for making changes on 30 consecutive days, just to try and get some momentum up in making progress on a couple of fairly low-key projects that hadn’t been going anywhere, and although I did cheat a few times (GitHub counts things like opening issues on a repo as ‘activity’ and I have plenty of bugs and features!), the vast majority of my activity was real commits, and I found 30 to be quite easy.
I think this is definitely something I’ll try again, but probably in 30-day chunks (each day only tends to give me ~30 minutes free to do any coding at home!), and probably with a more well-defined plan about what I’m actually expecting myself to ship within that time.
Anyway, despite the fact that I’ve finally broken my run, I’m pleased that I managed to get so much higher than I’d originally aimed for. Onwards!
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 myserver.com
$ mkdir /var/git/myapp.git
$ cd /var/git/myapp.git
$ git --bare init
Initialized empty Git repository in /var/git/myapp.git
Add the remote repository to your existing local git repo and push:
$ cd ~/code/myapp
$ git remote add myserver ssh://myserver.com/var/git/myapp.git
$ git push myserver master
You have now associated the remote repo with your local repo under the name “myserver”. Now open up
put something like this:
url = firstname.lastname@example.org:username/myapp.git
url = ssh://myserver.com/var/git/myapp.git
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.