背景:公司内部服务器个人git仓库,同时可通过Samba访问。
问题现象:由于之前一直在window下用小乌龟界面操作,最近开始逐渐尝试在Ubuntu上开发,所以开始试着使用git bash来维护代码,简单的git status,git diff,git add以及git commit操作一切正常,但是在git pull以及git push时遇到了问题;
提示信息为:
Permission denied(publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
首先这个仓库是一定存在的了,那么应当是认证出了问题;
git config —global --list
用户名以及邮箱无误,那应当是密钥的问题的;
由于小乌龟可以正常推送,所以查询小乌龟的密钥后,发现我的这个小乌龟密钥存放地址为:
c:/Users/{$your id}/Documents/.ssh/
而git bash的密钥存放地址为
c:/Users/{$your id}/.ssh/
将小乌龟的密钥复制过来,问题解决。
当然从新生成一份密钥然后全部替换掉也可以:
ssh-keygen -t rsa -C "youremail@example.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/{$}/.ssh/id_rsa)
或许我应该将小乌龟的密钥地址更改到与bash中一致?
避免同一个用户存放不同的认证密钥?