Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1147992
  • 博文数量: 312
  • 博客积分: 12522
  • 博客等级: 上将
  • 技术积分: 3376
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-27 18:35
文章分类

全部博文(312)

文章存档

2016年(3)

2015年(1)

2013年(1)

2012年(28)

2011年(101)

2010年(72)

2009年(13)

2008年(93)

分类: 项目管理

2011-03-26 22:55:54

  a@ubuntu:~$ sudo apt-get install git-core

  a@ubuntu:~$ sudo apt-get install openssh-server

  a@ubuntu:~$ sudo apt-get install openssh-client

  新加用户git,该用户将作为所有代码仓库和用户权限的管理者:

  a@ubuntu:~$ sudo useradd -m git

  为git设置密码:

  a@ubuntu:~$ sudo passwd git

  安装一下的setup tool, 这个也是为了gitosis做准备:

  apt-get install python-setuptools

  git clone git://eagain.net/gitosis.git

  cd gitosis

  python setup.py install

  客户端:

  shh git@服务器

  登录到服务器后

  mkdir example.git

  cd example.git

  git --bare init

  cd

  ssh localhost

  exit

  客户端:

  生成ssh key并传到git server上

  ssh-keygen -t rsa

  scp ~/.ssh/id_rsa.pub git@服务器:~/.ssh/

  ssh git@服务器

  cat ~/.ssh/id_rsa.pub >> authorized_keys

  chmod 755 /home/git

  chmod 700 /home/git/.ssh

  chmod 644 /home/git/.ssh/authorized_keys

  chmod 755 /www/git/repositories/gitosis-admin.git/\

  hooks/post-update

  exit

  mkdir example

  cd example

  git init

  touch README

  git add README

  git commit -m 'first commit'

  git remote add origin git@服务器:example.git

  git push origin master

阅读(1086) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~