ubuntu 下安装gitosis

1. Install git
sudo apt-get install git-core

2. Create git admin
sudo useradd -m git
sudo passwd git

3. Config git repository
sudo mkdir /home/git/repositories
sudo chown git:git /home/git/repositories
sudo chmod 755 /home/git/repositories
git config --global user.name "myname"
git config --global user.email "myname@server"

4. Install python
sudo apt-get install python-setuptools

5. Install gitosis
cd /tmp
git clone git://eagain.net/gitosis.git
cd gitosis
sudo python setup.py install

note: if you get time out error, that’s because git will not use system proxy, you need setup the proxy for git:
• Install corkscrew:
sudo apt-get install corkscrew

• Update  /home/{username}/.gitconfig
Add  

[core]
   gitProxy = /usr/bin/myproxy/git-proxy

• Create file git-proxy  under  /usr/bin/myproxy/
With concent:

exec /usr/bin/corkscrew proxy.aaaa.com 8080  eagain.net 9999

6. Install openssh
sudo apt-get install openssh-server openssh-client

7. Config openssh
ssh-keygen -t rsa


8. Config gitosis:
cp ~/.ssh/id_rsa.pub /tmp
sudo -H -u git gitosis-init < /tmp/id_rsa.pub
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

cd ~
git clone git@hostname:用户名/gitosis-admin.git
cd gitosis-admin/

9. Install gitweb
Install apache first:
sudo apt-get install apache2

sudo apt-get install gitweb


10. Config gitweb
Link static files:
cd /var/www/
sudo ln -s /usr/share/gitweb/*

edit gitweb.conf, remove the ‘#’ for red lines and update the data as below:

# path to git projects (<project>.git)
#$projectroot = "/var/cache/git";
$projectroot = "/home/git/repositories";
# directory to use for temp files
$git_temp = "/tmp";
# target of the home link on top of all pages
$home_link = $my_uri || "/";
# html text to include at home page
$home_text = "indextext.html";
# file with project list; by default, simply scan the projectroot dir.
$projects_list = $projectroot;
# stylesheet to use
@stylesheets = ("/gitweb/static/gitweb.css");
# javascript code for gitweb
$javascript = "gitweb/static/gitweb.js";
# logo to use
$logo = "/gitweb/static/git-logo.png";
# the 'favicon'
$favicon = "/gitweb/static/git-favicon.png";
# git-diff-tree(1) options to use for generated patches
#@diff_opts = ("-M");
@diff_opts = ();

11. Check gitweb:
Restart apache2:
sudo /etc/init.d/apache2 restart

visit
http://localhost/cgi-bin/gitweb.cgi



12. Reference:
http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
http://www.jiangmiao.org/blog/1600.html
http://www.linuxidc.com/Linux/2011-05/35638.htm
http://baike.baidu.com/view/1531489.htm

 

你可能感兴趣的:(JavaScript,python,ubuntu,ssh,git)