Wednesday, December 30, 2009

install a git server on ubuntu

install software
sudo apt-get install git-core gitweb


edit config with apache
sudo vim /etc/apache2/conf.d/git

<Directory /var/www/git>
Allow from all
AllowOverride all
Order allow,deny
Options ExecCGI
<Files gitweb.cgi>
SetHandler cgi-script
</Files>
</Directory>
DirectoryIndex gitweb.cgi
SetEnv GITWEB_CONFIG /etc/gitweb.conf

copy file
sudo mv /usr/share/gitweb/* /var/www/git
cp /usr/lib/cgi-bin/gitweb.cgi /var/www/git/


restart apache
sudo /etc/init.d/apache2 reload

//Then you can visit you git website.
http://localhost/git


=========================

create a new project rep
cd /var/cache/git/
sudo mkdir project.git
cd project.git
sudo git init
sudo vim .git/description
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git commit -a


git daemon start command
touch .git/git-daemon-export-ok
sudo git daemon --base-path=/var/cache/git --detach --syslog --export-all --verbose --enable=receive-pack


=====================
checkout code
cd ~
git clone git://server/project.git project