To set up a git server you will need two directories on your server, one for the repository files and another to make changes to your files in, known as your working files. Generally you will keep your working files in /var/www/ and your repository files in /repo/ but some operating systems may have a different file structure. If you don’t already have a /repo/ on your system, you’ll need to create one:

Change into the domain directory in /repo/ and create a bare repository:

Now change into your working files directory and clone this repository (it is currently still an empty repository):

Now add your files for your website to /var/www/ and add the files in git:

Commit your changes to git:

Push your changes to the bare git repository you created in /repo/

If you’re working with other developers you’ll need to pull before you push your commits