Creating your own Git repository server with OVH Debian VPS

Using your own Debian server to host a Git revision control repository can be fairly easy. Instead of relying on services like Github you simply log on to your command shell and install the git package which should be waiting for you there already.

sudo apt-get install git

After the package has been installed successfully you may want to create a new user who can access your Git repositories. Also add a bash so you can ease up further configurations for the time being.

sudo useradd -m -d /var/git -s /bin/bash -c 'Git' git

In order to save SSH keys for authorized users you wwitch to git role and store an authorized_keys file in you Git .ssh directory. Make sure only “Git” is allowed to read this folder and that only one SSH key per line is valid.

mkdir /var/git/.ssh

touch /var/git/.ssh/authorized_keys

chmod 700 /var/git/.ssh

You got yourself now an up and running Git server.

In case you want to migrate your existing repositories from GitHub to your new server you can do so by executing…

git --bare fetch https://username@github.com/username/repository-name.git master:master

… where of course username needs to be replaced by your actual GitHub username as well as respository-name by the respective GitHub repository name.

 

Sources:

  1. http://t3n.de/news/git-eigener-git-server-544264/
  2. http://git-scm.com/book/de/v1/Git-auf-dem-Server-Git-auf-einen-Server-bekommen
  3. https://www.digitalocean.com/community/tutorials/how-to-set-up-a-private-git-server-on-a-vps
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s