linux centos git server 简易搭建

dnf install git -y

id it
useradd git

su git
cd
mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
cat /tmp/id_rsa.john.pub >> ~/.ssh/authorized_keys

mkdir -p /opt/git/repo.git
git init --bare /opt/git/repo.git
chown -R git:git /opt/git


cat /etc/shells # see if `git-shell` is already in there. If not...
which git-shell # make sure git-shell is installed on your system.
vim /etc/shells # and add the path to git-shell from last command
chsh git # and enter the path to git-shell, usually: /usr/bin/gitshell


git clone git@ip:/opt/git/repo.git

https://www.cnblogs.com/dee0912/p/5815267.html
https://git-scm.com/book/zh/v2 - 服务器上的git

猜你喜欢

转载自www.cnblogs.com/wswind/p/10373881.html