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:
- 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
“`