Git Tutorial 05 – Setting up a git server
This video shows how to setup a Linux server to host Git repositories, WITHOUT GITHUB!
⚠️
This tutorial series was made in 2009-11. Back then Git was not as ubiquitous as today. Github had only been available for a few months, and Git was way harder to use. These days there are many other, better, more complete ways to learn git, and the tooling is so much better. These videos are included here for posterity.
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!