2013/10/30

Setup a git server via http protocol

Background
1. apached2 installed
2. Ubuntu 12.04 LTS
3. git installed
4. You are root

Steps
Enable git on http (git push should be work after that)
Follow the 2nd reference link, to summarize
1. Import dav module (I have no idea what dav is at this point)
2. Modify directory configuration so that others can access your git directory on your web server
3. Actually I use following config on git.conf since I don't need authentication
    <Location /my-new-repo.git>
       DAV on
    </Location>
4. Restart your apache

Create git repository on your web server (git clone should be work after that)
Follow the 1st reference link.
(EDIT
/* create from existing project */
$ cd /var/www/htdocs/ $ git clone --bare /path/to/git_project gitproject.git
$ chown -R www-data:www-data ./gitproject.git $ cd gitproject.git $ mv hooks/post-update.sample hooks/post-update $ chmod a+x hooks/post-update
$ git update-server-info
/* create from scratch */
$ cd /var/www/htdocs/ $ git init --bare gitproject.git
$ chown -R www-data:www-data ./gitproject.git $ cd gitproject.git $ mv hooks/post-update.sample hooks/post-update $ chmod a+x hooks/post-update
$ git update-server-info
)

Testing
git clone http://<hostname>/<dir>.git
$(some work)
git push

Linking up ticket system Bugzilla with git
https://github.com/gera/gitzilla seems to be a solution. However I cannot make them work. Leave me a message if you know how :'(

Enjoy :D

Reference
1. http://git-scm.com/book/en/Git-on-the-Server-The-Protocols
2. http://www.kernel.org/pub/software/scm/git/docs/howto/setup-git-server-over-http.txt

沒有留言:

張貼留言