Using GIT as Central Repository on a Server

Dec 16, 2013
1 min read
May 27, 2023 11:35 EEST

To use a git repository on a central server to sync it between several computers we will convert it to a bare repository and place the bare repository on a place we like to share it. For this the first step is to create this bare repository with:

umask 007
cd /usr/local/gitroot
git clone --bare /tmp/repo-to-clone.git my-shared-repo.git

Finally we have to set some parameters to share it:

cd my-share-repo.git
git config core.sharedRepository 1
git config receive.denyNonFastForwards true
find objects -type d -exec chmod 02770 {} \;

Check ‘git help config’ to see what the parameters will do. If you create a new repository you can use also git init --shared my-share-repo.git.

Now can can clone the repository change files commit it and push it to the server.


Related Posts