Git Tutorial 05 – Setting up a git server
So a couple of weeks ago I received an email asking how to go about setting up a Git server on Linux. This is actually pretty straight forward, provided you are familiar with Linux. I made a quick video describing the process:
In this video we end up accessing the repository on the server through SSH. There are alternatives to this, such as WebDav, or the built in Git protocol. However, everything I have ever worked on has used SSH to access the repository. It’s also how GitHub does it.
The basic steps:
- Connect to the server
- Make sure that all your developers have a user account on the server (adduser)
- Create a group on the system for your developers (addgroup)
- Add all the developers to that group. I did this by manually editing /etc/group on the server, but the more correct way would be to use the useradd command. That way you are less likely to mess up the group file.
- Create a directory in which to put the git repository.
- Set the group ownership to the group you just created (chgrp)
- Make the directory group read/writable, with the sticky bit set so subdirectories inherit the group permissions (chmod)
- Initialise a bare, shared repository
- ????
- Profit!
Hope that helps a bit!
Tags: git, Linux, repository, server, ssh


![Follow [wcl] on Twitter](http://twitter-badges.s3.amazonaws.com/t_logo-a.png)
