Win10+Cygwin环境下Github SSH访问遇Permission denied (publickey)求助
Cygwin下Git关联GitHub远程仓库失败:Permission denied (publickey),但SSH测试连接成功
我最近在Windows 10系统上用Cygwin搭建了本地Git仓库,想要关联GitHub的远程仓库时遇到了棘手的问题。执行添加远程仓库的命令:
git remote add github-remote git@github.com:username/github-remote.git
之后不管是尝试推送、拉取还是查看远程仓库信息,都会返回以下错误:
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.
更奇怪的是,我已经按照常规流程配置了SSH密钥,而且测试SSH连接GitHub是成功的:
ssh -T git@github.com
返回的成功认证提示为:
You've successfully authenticated, but GitHub does not provide shell access.
我已经排查过known_hosts文件、私钥权限等问题,也试过网上多种公开解决方案,但都没能解决这个问题,恳请各位大佬提供技术帮助。
我已尝试的操作步骤
- 生成RSA公私钥对,试过默认目录和自定义目录,结果一致:
ssh-keygen -t rsa -b 4096 -C "mymail@ex.com" - 启动并确认SSH代理处于运行状态:
eval $(ssh-agent -s) - 将私钥添加到SSH代理中:
ssh-add ~/.ssh/id_rsa - 把公钥
id_rsa.pub的完整内容复制到GitHub账户的SSH密钥列表中
内容的提问来源于stack exchange,提问作者user9498576
相关产品推荐
相关产品推荐

