Setup Git Server

Setup Git Server

  • Configuration
    • server:
      • **os:**Ubuntu 17.10
      • **ip:**192.168.81.132
    • client:
      • os: Ubuntu 16.04
      • **ip:**192.168.81.129

  • SERVER
sudo apt-get install git
sudo adduser git
  • CLIENT
ssh-keygen -t rsa
ssh-copy-id root@192.168.81.132
  • SERVER
$ sudo git init --bare sample.git
$ sudo chown -R git:git sample.git
  • SERVER
    Disable shell login
vim /etc/passwd
git:x:1001:1001:,,,:/home/git:/bin/bash
git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell
  • CLIENT
$ git clone git@192.168.81.132:/home/ubuntu17/srv/sample.git
Cloning into 'sample'...
warning: You appear to have cloned an empty repository.
git config --global user.email "xxx@xxx.com"
git config --global user.name "Hans"
touch test
git add .
git status
git commit -m "initial"
git push origin master

GIT(SSH) SERVER

Redhat 7.4

yum  install git
groupadd git 
useradd -g git /var/git -u git
$ cd /var/git
$ mkdir project.git
$ cd project.git
$ git --bare init


##GIT(SSH) CLIENT

ssh-keygen -t rsa
ssh-copy-id root@10.245.36.98
ssh root@10.245.36.98 ip a s; pwd; ls -l
“`


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值