看了很多GIT的资料,发现git依赖ssh链接远程仓库,自然公钥是需要的。
好奇心是害死人的,我试验了下:
root@US000690:/btsom/SCM/learn-git# git clone git@10.121.120.73:/btsom/SCM/zk/learn_git/sample.git
Cloning into 'sample'...
git@10.121.120.73's password:
warning: You appear to have cloned an empty repository.
root@US000690:/btsom/SCM/learn-git# git push -u origin master
git@10.121.120.73's password:
Counting objects: 6, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (6/6), 435 bytes, done.
Total 6 (delta 0), reused 0 (delta 0)
To git@10.121.120.73:/btsom/SCM/zk/learn_git/sample.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
最终结果是,需要人工输入远程仓库git密码。然后一切都 OK。
这个问题可能会造成git与jenkins等CI工具集成的时候住。因为CI工具会帮你填密码的。