1. Create a git user for the CentOS system
useradd -d /home/git git #创建git用户passwd git #修改密码
2. Open the CentOS system RAS Certification
vim /etc/ssh/sshd_config
Open the following comment and modify it as follows
3, download the Windows version of the GIT installation software, according to the operating system select 32-bit or 64-bit
https://git-scm.com/download/win
4, install Git, always next
5. Build SSH key for Windows, right-click on the directory point, choose Git Bash here, enter the following command on the Open command line to confirm
ssh-keygen -t rsa -C "[email protected]"
6. Upload SSH key to the CentOS system and enter the following command in the Windows git bash
ssh [email protected] ‘cat >> .ssh/authorized_keys‘ < ~/.ssh/id_rsa.pub
After successful check the CentOS system/home/git/.ssh/directory to generate the Authorized_keys file, and whether the file has the Id_rsa.pub public key content of Windows, the file is located in the C:\Users\xxx.ssh directory
7. Create a repository in the CentOS system
su gitcd /home/git/mkdir repositorycd repositorymkdir test.gitgit init --bare test.git
8, prohibit git users to login shell, subsequent creation of the repository can be created by the root user, created chown for git users
vim /etc/passwd
9. Through the Windows Remote clone Repository, create a directory to clone in Windows, open git Bash, enter
git initgit clone [email protected]:/home/git/repository/test.git
Git configuration (ii) Windows installs Git and configures CentOS as a remote repository