GIT is already installed on the Raspberry PI.
You can therefore easily connect to remote GIT-repositories at for example GitHub.
I thought it would be fun to host my own remote repositories on the Raspberry Pi; (just because it is possible).

This page explains how I did this. First I created a git-user:
sudo useradd git. (a simple password will do.)
In the home directory of the git user I created a .ssh directory. I copied the authorized_keys from my sudo user’s home to /home/git/.ssh:
sudo cp /home/<user>/.ssh/authorized_keys /home/git
and set the ownership to the GIT-user sudo chown -R git /home/git.

I created folder /mnt/raiddrive/git with the GIT-user as owner. Remote GIT-repositories wil reside in this folder. I also made a link from /home/git to this location: sudo ln -s /mnt/raiddrive/git /home/git/repos

Now I changed to the git user:
sudo -i
su -l git
Now create a GIT-repository thatwill be used for WordPress:
git init –bare ~/repos/wordpress.git

This GIT-repository must made accessable for the WordPress plugin Revisr. This plugin runs with user www-data. The home directory of this user is currently /var/www.
I don’t like that as the location for the .ssh folder. I want it to be /home/www-data. So I changed the home directory of user www-data. First check all services (sudo service –status-all) that currently use the www-data user and stop them:
sudo service apache2 stop
sudo service php7.0-fpm stop
Change the home directory:
sudo usermod -d/home/www-data www-data
sudo mkdir -p /home/www-date/.ssh
sudo chown -R www-data /home/www-data
Restart the services:
sudo service apache2 start
sudo service php7.0-fpm start

With the home directory in place, it is time to generate the keys for SSH.
sudo -i
su -l www-data -s /bin/sh

ssh-keygen
exit
cat /home/www-data/.ssh/id_rsa.pub >> /home/git/.ssh/authorized_keys

Now confirm the autheticity of the host, because Revisr is unable to do so.
su -l www-data -s /bin/sh
ssh git@raspberrypi
Cofirm the authenticity and exit.
Now the Revisr plugin should be able to use URL
ssh://git@raspberrypi/~/repos/wordpress.git as it’s remote GIT-repository.

These settings are stored in /var/www/html/wordpress/.git/config