搞了一周ubuntu上git服务器的搭建,做个笔记。
---------------------------------------------------------------------------
sudo apt-get update
sudo apt-get upgrade
// ssh
sudo apt-get install openssh-server
gedit /etc/ssh/sshd_config
sudo /etc/init.d/ssh restart
//
sudo apt-get install python-setuptools.py
or
sudo apt-get install python-setuptools
// git
sudo apt-get install git-core // if failed, add http://archive.ubuntu.com/ubuntu/pool/main/
mkdir gitosis_setup
cd gitosis_setup
git clone git://eagain.net/gitosis
cd gitosis
sudo python setup.py install
// add gitosis user
sudo useradd -m git
sudo passwd git
// 在git管理员PC上产生id_rsa.pub,然后拷贝到git服务器
ssh-keygen -t rsa
sudo chmod 777 id_rsa.pub
# windows key to linux key
#ssh-keygen -i -f Iid_rsa.pub >> /home/droid/.ssh/authorized_keys2
sudo -H -u git gitosis-init < id_rsa.pub
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
// 在git管理员PC
git clone git@IP:gitosis-admin.git
// 如果遇到
git clone git@IP:gitosis-admin.git
Initialized empty Git repository in /home/yang/gitosis-admin/.git/
Agent admitted failure to sign using the key.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
// 解决方法,在管理员PC上
# ssh-add ~/.ssh/id_rsa
空仓库的建立
git --bare init
软链接的建立
ln -s 源文件 目标文件