在ubuntu下搭建git服务器

  1. ubuntu系统配置
    1. 安装openssl
      1. sudo apt-get install openssh-server openssh-client
    2. 创建公钥和私钥
      1. ssh-keygen -t rsa (一般在用户目录下/home/[user])
  2. 安装Git
    1. 安装Git-Core
      1. sudo apt-get install git-core
    2. 安装 python setup tool
      1. sudo apt-get install python-setuptools
    3. 安装gitosis
      1. cd /tmp
        git clone https://github.com/res0nat0r/gitosis.git
        cd gitosis
        sudo python setup.py install
  3. 配置Git
    1. 创建git用户
      1. useradd -m git
        passwd git
    2. 创建git仓库
      1. sudo mkdir /home/git/repositories
    3. 设置仓库权限
      1.  sudo chown git:git /home/git/repositories
      2. sudo chmod 755 /home/git/repositories
    4. 初始化全局变量
      1. git config –global user.name “junior”
      2. git config –global user.email “junior.zhou@coiat.com
    5. 配置gitosis
      1. cp ~/.ssh/id_rsa.pub /tmp
      2. sudo -H -u git gitosis-init < /tmp/id_rsa.pub
      3. sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
    6. 管理gitosis
  4. 客户端使用git

更多阅读

分类:
|  标签 : 
0 0 vote
Article Rating
Subscribe
提醒
guest
2 评论
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
防火板
6 年 之前

好文章,内容维妙维肖.