Setting up a GIT server
21 January 2012
I wanted to share development trees with some friends and of course needed a GIT server! Using GITHUB was not an option because I need a private area so I decided to create my own GIT server on EC2.
Installing the server
Install the GIT package
sudo yum install git
Create a user account to host the projects files.
sudo useradd --system --shell /bin/bash --comment 'git version control depot' --user-group git
Create the ssh key that will be used by gitosis to manage the git repository
ssh-keygen -t dsa -f ~/.ssh/git
Initialize the GIT repository
sudo -H -u git gitosis-init < git.pub
Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/
Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/
Activate gitosis post-update hook
sudo chmod u+x /home/git/repositories/gitosis-admin.git/hooks/post-update
Configuring gitosis
Gitosis configuration is done using git! So to configure gitosis, you need to checkout the gitosis-admin repository with git. There is a pitfall: git will try to connect to the repository using ssh and you need to tell ssh to use the private key we created previously.
cat<<EOT >> ~/.ssh/config
Host localhost
IdentityFile ~/.ssh/git
IdentitiesOnly yes
EOT
blog comments powered by Disqus