Web server - Git server setup

From XennisWiki
Jump to: navigation, search

This article describes how to setup FTP on a Ubuntu web server using the Git server gitolite.

Setup gitolite on an Ubuntu server

Further information: How To Use Gitolite to Control Access to a Git Server on an Ubuntu 12.04 VPS, gitolite documentation - quick install, setup, and clone

Install Git and gitolite itself

apt-get install git-core gitolite

Setup git user

# Create a user named "git"
adduser --system --group --shell /bin/bash --disabled-password git
# Set the user as a allowed ssh user
echo "AllowUsers git" >> /etc/ssh/sshd_config
# Restart ssh service
service ssh restart

Setup gitolite and git admin (Change the path /tmp/git-admin.pub accordingly to a ssh public key file. The owner of the key will be the admin.)

su - git
gl-setup /tmp/git-admin.pub

Administrate gitolite

Clone a GIT repository form your server to your local PC by the fallowing command

git clone git@YOUR-SERVER:gitolite-admin

Add a new repository

Add to the conf/gitolite.conf file the following lines to create the repository myRepo

repo	myRepo
		RW+	= @all

After pushing the changes in the gitolite-admin.git repo, your are able the clone the created repository.

# Clone repository "myRepo"
git clone git@YOUR-SERVER:myRepo
cd myRepo
# Create readme file and commit it
echo "Hello World" > readme.md
git add readme.md
git commit -a -m "Add readme file"
# Push change to server
git push origin master:master

See also

External links