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:

  1. Connect to the server
  2. Make sure that all your developers have a user account on the server (adduser)
  3. Create a group on the system for your developers (addgroup)
  4. 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.
  5. Create a directory in which to put the git repository.
  6. Set the group ownership to the group you just created (chgrp)
  7. Make the directory group read/writable, with the sticky bit set so subdirectories inherit the group permissions (chmod)
  8. Initialise a bare, shared repository
  9. ????
  10. Profit!

Hope that helps a bit!

Published by

Michael Marner

My name is Michael, and this is my website. I am currently working as a Research Fellow at the University of South Australia's Wearable Computer Lab. I am also the chair of the board and an announcer at Adelaide based community radio station Three D Radio 93.7FM.

Leave a Reply

Your email address will not be published. Required fields are marked *