webSIGHTdesigns - Web Design, Web Development, Web Hosting

How to Set Up a Linux Git Server

Posted on Sunday, June 1st, 2014 at 10:20 pm
by webSIGHTdesigns

How to configure git on a Linux web server.

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/domain.com/ and your repository files in /repo/domain.com/ but some operating systems may have a different file structure. If you don't already have a /repo/domain.com/ on your system, you'll need to create one:

$ mkdir -p /repo/domain.com/

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

$ cd /repo/domain.com/
$ git --bare init

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

$ cd /var/www/
$ git clone ssh://user@server.com/repo/domain.com ./domain.com

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

$ git add .

Commit your changes to git:

$ git commit -m 'initial commit'

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

$ git push

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

$ git pull

Please Sign In

Please sign in to post a comment.

Web Development

View details »

Web Hosting

View details »

Our Portfolio

View portfolio »

WebSight Designs webSIGHTdesigns preferred email webSIGHTdesigns United States United States