GIT server installation

GIT Server installation

Install the image as a virtual or a real server. Choose a WEB server to be included during the installation. If a virtual server is being installed, create a separate virtual volume for git repositories and attach it to the virtual sever. If installing on a real HW, it is highly recommended to create a separate partition for git data at the installation time (perform custom disk partitioning).

Partition the disk which will contain git repositories. Let us assume it is seen in the system as /dev/sdb device:

$ sudo fdisk /dev/sdb

Command (m for help):
>n

Command action
e extended
p primary partition (1-4)
>p

Partition number (1-4):
>1
>enter
>enter
>w

$ sudo mkfs.ext4 /dev/sdb1

$ sudo mkdir /srv

$ sudo mount /dev/sdb1 /srv/

Make the git partition automounted by adding the following line to /etc/fstab:

/dev/sdb1 /srv ext4 defaults 0 0

Install git and gitweb (for git: protocol support):

sudo apt-get install git
sudo apt-get install gitweb

Create the folder structure on the git partition:

sudo mkdir /srv/git
sudo mkdir /srv/git/pub

Create the git user:

sudo adduser git

Note: this user is for use in the public git repository only. Public git repository provides free access for git user (with write permission). All repositories which need limited write access will be placed under /srv/git structure with corresponding owner and permissions.