Installation | Topics | Beyond Lino
Setting up a private git server¶
GitHub and GitLab are popular sites for managing software source code and related issues. However, one may want to set up a private Git server. The steps necessary to create a repository on a Linux server are presented below:
$ sudo adduser git
$ sudo su git
$ cd
$ mkdir .ssh
$ chmod 700 .ssh
$ touch .ssh/authorized_keys
$ chmod 600 .ssh/authorized_keys
$ mkdir xxxx.git
$ cd xxxx.git
$ git init --bare
Now, each user’s public ssh-key should be added to authorized_keys.
On client side, the following steps should be done:
$ mkdir xxxx
$ cd xxxx
$ git init
$ touch README
$ git status
$ git remote add origin git@yourgitserver.net:/home/git/xxxx.git
$ git add .
$ git push origin HEAD:main
$ git push origin main --force
$ git commit -m "initial commit"
$ git push origin main
$ git status
$ nano README // add some text and save
$ git commit -a
$ git status
$ git push --set-upstream origin main
To check, whether the configuration works:
$ cd /tmp
$ git clone git@yourgitserver.net:/home/git/xxxx.git
$ ls xxxx
One should see README in /tmp/xxxx.