Ubuntu上git服务器的搭建

2 篇文章 0 订阅

搞了一周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 源文件 目标文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值