Fedora (Ubuntu) 搭建 Git 服务器方法 -- set Git sever on Fedora(Ubuntu)
1. install openssh-servercmd: yum install openssh-server (ubuntu: sudo apt-get install openssh-server)
2. install git-core
cmd: yum install git-core (ubuntu: sudo apt-get install git-core)
3. install gitosis
cmd:
cd ~/ gitosis_setup
git clone git://eagain.net/gitosis
or git clone https://github.com/res0nat0r/gitosis.git
or download the gitosis files(from: https://github.com/res0nat0r/gitosis) and unexpressed to gitosis_setup/
(yum install python-setuptools)
python setup.py install
4. create git user
cmd:
useradd -m git (ubuntu: sudo useradd -m git)
passwd git (ubuntu: sudo password git)
5. initial the gitosis
//first copy ssh key id_rsa.pub(google for id_rsa.pub produce) to /tmp then:
cmd:
cd /tmp
chmod 777 id_rsa.pub (ubuntu: sudo chmod 777 id_rsa.pub)
sudo -H -u git gitosis-init < id_rsa.pub
//enable others can clone the gitosis-admin.git
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
6.insatll gitweb
cmd:
yum install gitweb (ubuntu: sudo sudo apt-get gitweb)
7.install apache
cmd:
yum install httpd (ubuntu: sudo sudo apt-get apache2)
8. just for Ubuntu:
cmd:
cd /var/ www/
sudo ln -s / usr/ share/ gitweb/* . (do not lost the ".")
9. modify the gitweb.conf file
cmd:
$ echo "\$projectroot = '/srv/git/repositories';" > /etc/gitweb.conf
(ubuntu:
cmd:
sudo vim /etc/gitweb.conf
//then change the value of $projectroot to "/home/git/repositories")
sudo chmod 777 -R /home/git (ubuntu: sudo chmod 777 -R /home/git/repositories)
10. visit the gitweb
http://(localhost or 127.0.0.1 or ip)/git/gitweb.cgi
11. apache config and gitosis admistration
To be continued...
Reference
1. http://blog.youkuaiyun.com/wirror800/article/details/5189564
2. http://blog.youkuaiyun.com/jincheng121/article/details/7487860
3. http://markmcb.com/2008/09/19/installing-gitweb-on-fedora-linux-and-apache/