GitHub 通过 SSH KEY Clone 私有仓库报错和解决简记
我的Github已经上传了我的SSH公钥,但是当我Clone确出现了权限报错。我拥有私有仓库的权限,且通过ssh -T git@ithub.com
验证证明SSH设置正确。后发现和我使用SSH-Agent有关故简单记录解决方法。
好久不写懒了 不排版了直接写了
1.报错形式
Cloning into 'YOUR_BAsE_NAME'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
2.验证SSHKey
Hi YOUR_NAME! You've successfully authenticated, but GitHub does not provide shell access.
3.问题原因及解决
问题出在SSH-Agent上,一半正常SSH链接都将会使用SSH-Agent上已经缓存的私钥,但是当使用git指令克隆时,如果你未经特殊配置(我还未验证)git clone并不会使用Agent中以经缓存的key,而是仅查看C:\Users\YOUR_NAME\.ssh
(默认情况下)中存在的KEY。
问题明了,那么简单的解决方法为将Github中存储公钥对应的私钥放置到C:\Users\YOUR_NAME\.ssh
(默认情况下)即可。
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
评论已关闭