-
Install git
yum install git orapt-get install git
-
Creating a user logs in git
groupadd git / # git name Here you can modify for your own useradd git - G git # users to join the group git
git # password to verify the password for the user behind the provinces git user passwd] -
Create a public
This is the git inside the special step of the operation, when the communication client and server requires a certificate for authenticationcd ~
ssh-keygen -t rsa#公钥在/root/.ssh 目录下
id_rsa.pub is the public key
by opening the text vim id_rsa.pub then copy the contents inside come out
into the git user created
#进入 git用户主目录
cd /home/git/ #创建.ssh文件夹如果有可以忽略 mkdir .ssh #进入此目录创建authorized_keys 将刚才复制的公钥粘贴进去
cd .ssh
vim authorized_keys -
Create a git repository
#创建一个文件夹
mkdir git_Project
#创建将创建文件夹的用户与用户组设置为前面创建的git用户 chown -R git:gitgit_Project
#修改文件权限
chmod 777 git
#现在我们可以创建git仓库了git init --bare name.git #初始化一个git仓库
#设置权限
chmod 666 name.gitchown -R git:git
name.git
After the above steps back down on our local computer, we can use the warehouse to try whether by cloning:
git clone git@10.0.0.121:/var/git/arepoforyourproject.git