Setting Up Your Secure Git Server Using Gitosis

This tutorial describes how to setup a git server if you have a similar setup like mine. I have a live server running linux and I use windows & linux for development. I’ll keep it as brief as possible and let you figure out the rest. If a part isn’t clear, just ask. Here is a brief overview of what we’ll do.

  • Setup Gitosis on your linux server.
  • Setup a git client for your windows box
  • Clone Your Repository on your Windows Box
  • Commit, Push and Pull
  • Deploy Online

Setup Gitosis

Tutorial for Setting Up Gitosis
Tutorial for Setting Up Gitosis on Ubuntu

Setup Git on Windows

  • Download and install Git from msysgit

    Be sure to download the full version if you’ll like to use the Git GUI eg. Git-

  • Startup Git Bash
  • Run

    # ssh-keygen -t rsa
    Do not add a passphrase.

  • Upload your public key to your gitosis-admin

Clone Your Repository

Now that you have git installed, you will need to download your working copy of the project. Your working copy [WC] is what you will be working on so I suggest that you create it in a folder in your webroot. The following steps will help you achieve that.
 Using Git GUI
  • Enter Source Location


  • Target Directory


    Using Git Bash

  • # cd /install-dir
  • # git clone git@YOUR_SERVER:YOUR_PROJECT.git

Committing & Pushing Changes

Now that you have your working repository and you have made modifications to the project, its time to commit (update repository with changes) and push (upload to central repository).
Using Git GUI
  • Start Git GUI
  • Click Open Existing Repository and select your repository. Alternatively, you can select your repository from the list under Open Recent Repository. You can also create a Desktop shortcut to your repository from Git GUI. Once you have opened your repository, click on the Repository menu and click on Create Desktop Icon
  • Click on Rescan. This should show all the modified files in your repository.
  • Select all the files in the Unstaged Changes list and click on the Commit menu and then Stage to Commit.
  • Enter you Commit Message. For tips on how to write good commit messages goto
  • Click on Sign Off
  • Click on Commit
  • Click
    on Push 

Deploying Online

  • Clone your application in your webserver root.
  • To update your online copy after making updating the central repository, just
    # git pull



One thought on “Setting Up Your Secure Git Server Using Gitosis

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s