HowTo use Git for Collaborative Development
This is mainly some notes for myself so I don't forget. Having worked with GNU Bazaar before much of Git is still alien to me.
This HowTo is divided into two parts, 1) what happens on your laptop, and 2) what you must do on a remote server where you publish your changes.
laptop> mkdir projectX; cd projectX laptop> git init laptop> emacs file1.txt laptop> git add file1.txt laptop> git commit -m "Initial commit"
Thus far no suprises, right? Now, some nasty git bits:
laptop> emacs file1.txt laptop> git commit
Yep, doesn't work. You have to add -a to the command line for "all".
laptop> git commit -a
OK, so next item. How to publish this so others can see? Well, I have a shell account on a remote server, so I naturally try:
laptop> git push sftp://login@example.com/pub/git/projectX.git fatal: I don't handle protocol 'sftp'
Does not work. OK, next obvious choice:
laptop> git push ssh://login@example.com/pub/git/projectX.git fatal: '/pub/git/projectX.git': unable to chdir or not a git archive fatal: The remote end hung up unexpectedly
Wow, not a clue as to how I should proceed. After some Google-Foo I found this article detail the steps for remote repos. Very messy, compared to Bazaar.
laptop> ssh login@example.com server> cd /pub/git server> mkdir projectX.git; cd projectX.git server> git --bare init server> logout laptop> git remote add origin ssh://login@example.com/pub/git/projextX.git laptop> git push No refs in common and none specified; doing nothing. Perhaps you should specify a branch such as 'master'. fatal: The remote end hung up unexpectedly error: failed to push some refs to 'ssh://login@example.com/pub/git/projectX.git' > git push origin master Counting objects: 29, done. Compressing objects: 100% (26/26), done. Writing objects: 100% (29/29), 9.54 KiB, done. Total 29 (delta 10), reused 0 (delta 0) To ssh://login@example.com/pub/git/projectX.git * [new branch] master -> master
Eventually I made it sing. The first "git push" must use the references to origin and master. At least you don't have to care about that later, after the first push command git remembers what you want.
Only one thing left, in the gitweb project overview projectX is listed as having no description. Of course, since I'm starting to get to know git by now, I realised early this is probably not something that is propagated through push — yep, I was right. You have to change that on the server.
laptop> ssh login@example.com server> cd /pub/git/projectX.git server> echo "Secret Project-X use ROT13 to decode all source files" >description server> logout
All done! *phew*
Friday, 12 June 2009 at 23:50 | /programming | permanent link to this entry
Heh
Friday, 12 June 2009 at 19:53 | /misc | permanent link to this entry
More about Bzrweb and some about Git
OK, I admit it. I cannot decide what version control system (VCS) to use. I'm stuck between the speed and massive snow ball effect of Git and the ease of use and emotional attachment I have to Bazaar.
I've been "maintaining" bzrweb for a while now, not doing a very good job of it though. It's lagging behind considerably to the bzr API. After the upgrade of vmlinux.org to the latest Ubuntu server release bzrweb actually didn't work at all. If it hadn't been for the fixes by Rasmus Toftdahl Olesen I would probably have abandoned it entirely. Thank you Rasmus! Anyway, I've been gleaning at other Bazaar web frontends for a while. The only real option is Loggerhead, but even though I consider myself a computer pro I just cannot seem to wrap my head around how to set it up. I just wanted to setup a local browser for my user, without the need for root access. Like bzrweb supports, after having abandoned that, seemingly radical idea, I tried setting up a site wide shared installation ... no luck so far. :-/
In comparison to Loggerhead I easily managed to setup a Git repository browser, using a /pub/git structure, see git.vmlinux.org. The gitweb package in Ubuntu was very easy to setup, the one only thing I had problem with was the Apache VirtualHost setup. Some sleep cured that, but I should post the conf here, in case someone else experiences trouble.
I'll have another go at setting up Loggerhead later, or perhaps try to fixup bzrweb. I'm currently leaning towards fixing up bzrweb. Fix bugs viewing tree files, refactor tarball export and a new project summary page, are some of the most interesting things I can come up with. If only things could settle down at work for a while — oh well, vacation is coming up. Soon, my precious, soon...
First, however, I will publish the micro vt100/ansi tetris version I found last week. It will be the second project where I use Git, the first one was cons, which is a Xen xm wrapper for non privileged users.
Some Git and Bazaar links:
Friday, 12 June 2009 at 19:50 | /programming | permanent link to this entry