Thursday, December 27, 2012

Installation Guideline for GIT Server on linux




Installation Guideline for GIT Server
1.       Yum install git git-daemon (If git is not available through yum kindly install rpmforge repo from http://pkgs.repoforge.org/rpmforge-release/rpmforge-release.*.rpm)
2.       mkdir <git directory>
3.       cd <git directory>
4.       git init

Configuration of Apache with Git
<VirtualHost *:80>
        ServerName git.confiz.com
        DocumentRoot /git
        <Directory /git/>
                DAV On
                Options ExecCGI FollowSymLinks Indexes
                # Deny everyything here
                Deny from all
                AuthType Basic
                AuthName "git repository"
                AuthUserFile /etc/httpd/htpasswd.git
        </Directory>

        <Directory /git/<clinetname>/<projectrepo>
                Allow from all
                Order allow,deny
                <Limit GET PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
                        Require user <allowed user>
                </Limit>
        </Directory>
</VirtualHost>

Adding htpasswd file and its user

Creating file + adding user > htpasswd -c  /etc/httpd/git/htpasswd.git <username>
                                                   Note: you will be prompted for password

Adding user to existing file > htpasswd /etc/httpd/git/htpasswd.git <username>
                                                    Note: you will be prompted for password


Adding a new repo

1.       mkdir <client folder>/<project repo>  –p
2.       cd <client folder>/<project repo>/
3.       git --bare init
4.       chown apache.apache -R /git/<client folder>/<project repo>
5.       sudo -u apache git update-server-info
6.       Add proper entry in  > vi /etc/httpd/conf.d/git.conf
7.       Create username for access > htpasswd /etc/httpd/htpasswd.git <username>
8.        service httpd reload

No comments:

Post a Comment