阅读目录:
1. 新建项目仓,配置GitLab
2. 添加用户
3. 配置客户机端的git(win平台)
4. 配置ssh
5. 调试客户机端的git的连接
1. 新建项目仓,配置GitLab
1.1 新建项目仓
1.2 添加必要信息
1.3 完成建仓
2. 添加用户
2.1 添加用户
2.2 配置用户属性
3. 配置客户机端的git(win平台)
前提:鼠标右击项目,点击 git bash here
3.1 创建SSH Key
$ ssh-keygen -t rsa -C "[email protected]"
比如:---> $ ssh-keygen -t rsa -C "[email protected]"
3.2 配置全局变量
$ git config --global user.name "Your Name" $ git config --global user.email "[email protected]"
比如:---> $ git config --global user.name "lou" $ git config --global user.email "[email protected]"
4. 配置ssh
4.1 查看客户机端的公钥
打开C:\Users\Administrator\.ssh
4.2 编辑文件id_rsa.pub
复制公钥
4.3 添加ssh公钥到GitLab
回到GitLab配置页面,
添加公钥,
5. 调试客户机端的git的连接
5.1 从远程库克隆
$ git clone [email protected]:root/newProject.git warning: You appear to have cloned an empty repository.<正常现象,远程仓此时没东西>
5.2 拉取git仓代码<只用输入yes>
$ git pull
The authenticity of host '192.168.19.128 (192.168.19.128)' can't be established.
RSA key fingerprint is SHA256:YmaS17gQlWUCYOku0w1dpVYmrq/QILGIpOpTqEq1yy0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.19.128' (RSA) to the list of known hosts.
From 192.168.19.128:root/newProject
* [new branch] master -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
注:用 git push 同样的效果,当你第一次使用Git的pull或者push命令连接GitLab时,会得到一个警告。