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

 

1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值