由于使用的是普通用户登录的Ubuntu,且用普通用户创建的ssh key并添加到git lab服务器,所以在给git clone时,不能使用超级用户(root),否则会提示你输入密码,而这个密码无论你怎么输入都会出错。
xxxx@sdb1$ sudo git clone git@172.32.252.101:xxxx/Source/git-repo.git
正克隆到 'git-repo'...
git@172.32.252.101's password:
Permission denied, please try again.
git@172.32.252.101's password:
Permission denied, please try again.
git@172.32.252.101's password:
所以不要使用sudo取克隆代码就可以了,但必须保证所在的目录sdb1有读写权限。
xxxx@sdb1$ git clone git@172.32.252.101:xxxx/Source/git-repo.git
正克隆到 'git-repo'...
remote: Counting objects: 3819, done.
remote: Compressing objects: 100% (1479/1479), done.
remote: Total 3819 (delta 2279), reused 3819 (delta 2279)
接收对象中: 100% (3819/3819), 1.44 MiB | 1.76 MiB/s, 完成.
处理 delta 中: 100% (2279/2279), 完成.
检查连接... 完成。