Looking for a European alternative to GitHub? Look no further than Git itself
Here's the step-by-step guide.
Change directory to your local git repository that you want to share with friends and colleagues and do a bare clone git clone --bare . /tmp/repo.git
You just created a copy of the .git
folder without all the checked out files.
Upload /tmp/repo.git
to your linux server over ssh. Don't have one? Just order a tiny cloud server from Hetzner. You can place your git repository anywhere, but the best way is to put it in a separate folder, e.g. /var/git
. The command would look like with scp -r /tmp/repo.git me@server:/var/git/
.
To share the repository with others, create a group, e.g. groupadd --users me git
You will be able to add more users to the group with groupmod
.
Your git repository is now writable only by me
. To make it writable by the git
group, you have to change the group on all files in the repository to git with chgrp -R git /var/repo.git
and enable the group write bit on them with chmod -R g+w /var/repo.git
.
This fixes the shared access for existing files. For new files, we have to make sure the group write bit is always on by changing UMASK from 022 to 002 in /etc/login.defs
.
There is one more trick. For now on, all new files and folders in /var/git
will be created with the user's primary group. We could change users to have git
as the primary group.