Git 是一个免费开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。
Git 与常用的CVS, SVN 等不同,它采用分布式版本库的方式,不必服务器端软件支持。
1. 安装客户端Git-2.36.0-64-bit.exe到Windows系统
2.在bash窗口,输入ssh-keygen -t rsa -C "test@autotestPlat.com"
一直输入回车
3. cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2JpLMqgeg9jB9ZztOCw0WMS8hdVpFxthqG1vOQTOji/cp0+8RUZl3P6NtzqfHbs0iTcY0ypIJGgx4eXyipfLvilV2bSxRINCVV73VnydVYl5gLHsrgOx+372Wovlanq7Mxq06qAONjuRD0c64xqdJFKb1OvS/nyKaOr9D8yq/FxfwKqK7TzJM0cVBAG7+YR8lc9tJTCypmNXNngiSlipzjBcnfT+5VtcFSENfuJd60dmZDzrQTxGFSS2J34CuczTQSsItmYF3DyhqmrXL+cJ2vjZWVZRU6IY7BpqJFWwfYY9m8KaL0PZ+JJuaU7ESVBXf6HJcQhYPp2bTYyff+vV test@autotestPlat.com
4. 复制以上秘钥后,在浏览器打开git网址
http://192.168.111.222/admin/repos/AutoTestPlat
输入用户名密码登录 把copy的公有密钥粘贴到 页面Settings-SSH KEY中;
把邮件地址test@autotestplat.com填写正确
5.本地:
C:\Users\fin\.ssh
设置config:
Host 192.168.111.222
HostName 192.168.111.222
User fin
PubkeyAcceptedKeyTypes +ssh-rsa
IdentityFile ~/.ssh/id_rsa
Port 29418
6. 本地cmd ,输入以下命令克隆项目到本地,其中fin是用户名,AutoTestPlat是项目
git clone "ssh://fin@192.168.111.222:29418/AutoTestPlat" && scp -p -P 29418 fin@192.168.111.222:hooks/commit-msg "AutoTestPlat/.git/hooks/"
Cloning into 'AutoTestPlat'...
remote: Counting objects: 2, done
remote: Finding sources: 100% (2/2)
remote: Total 2 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (2/2), done.
7. 切换到克隆下来的AutoTestPlat目录,执行以下步骤指令
1) git pull
2) 添加目录所有文件 git add .
3) 提交到缓冲区并注释 git commit -m “message”
4) 上传 git push origin HEAD:refs/for/master
Enumerating objects: 555, done.
Counting objects: 100% (555/555), done.
Delta compression using up to 8 threads
Compressing objects: 100% (538/538), done.
Writing objects: 100% (554/554), 22.12 MiB | 21.35 MiB/s, done.
Total 554 (delta 130), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (130/130)
remote: Processing changes: refs: 1, new: 1, done
remote:
remote: SUCCESS
remote:
remote: http://192.168.111.222/c/AutoTestPlat/+/1962 msg [NEW]
remote:
To ssh://192.168.111.222:29418/AutoTestPlat
* [new reference] head -> refs/for/master