Git servers for the rest of us
I’m sure you’ve heard about the cool new kid on the source code management block: git
There’s lots of good info already out there about how to install git on your machine. My good buddies over at Kinetic Web Solutions even put up a nice set of commands to get it installed. First hint: it doesn’t involve MacPorts.
But before I really use something, I need to know how to make my own server. GitHub is cool for open source projects ‘n all. But I don’t really see my employer going for hosted source code any time in the near future.
Today I had an “a ha!” moment with git. Much like I had with subversion when I first started using it. Specifically: You don’t need apache
Put aside your mod_dav woes and embrace ssh with open arms…
on the server:
mkdir -p git/myproject cd git/myproject git init
on the client:
rails myproject # or however you start your project (or use an existing one) cd myproject git init git add . git commit -m "Initial commit." git remote add origin myserver.com:git/myproject git push origin master
That’s it. Your project is now using git and pushed up to a central repository that other people can pull from (assuming they have ssh access). I’m still new to this, so I’m sure there are a few gotchas that I’ll come across later. And you probably have to be careful about group ownership in this situation. But it shouldn’t be anything a good ol’ chmod g+w wouldn’t fix.
If a coworker also needs a copy, just have them do…
git clone myserver.com:git/myproject
Git it? Good. :)