有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,GitHub存储库存在,我不知道现在该做什么。
> git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,GitHub存储库存在,我不知道现在该做什么。
> git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
当前回答
你需要生成一个SSH密钥(如果你没有的话),并将公钥与你的Github帐户相关联。参见Github自己的文档。
其他回答
您可以使用Https url登录
我猜你是试图登录SSH url 当你说git push,如果它只要求密码,考虑你是通过ssh连接。最好使用HTTP url。
这个答案与其他答案略有不同,但在其他情况下,您可以在系统上正确配置SSH密钥,但仍然会遇到这种情况。
我在一个孤立的环境中(例如使用Tox)在python子进程中运行git命令时遇到了这个问题。我通过传递SSH_AUTH_SOCK和SSH_AGENT_PID环境变量来修复它。
你需要生成一个SSH密钥(如果你没有的话),并将公钥与你的Github帐户相关联。参见Github自己的文档。
同样在ubuntu中,即使在BitBucket的设置中已经输入了SSH密钥,我还是遇到了这个问题。原因是,我尝试了以下几点:
sudo git push origin master
不知道为什么,但它解决了使用
git push origin master
没有使用sudo。
我想补充一些我的发现:
如果您正在使用GitBash,那么请确保SSH密钥存储在~/. SSH /id_rsa中。
默认情况下,git会搜索~/。ssh/id_rsaas ssh密钥的默认路径。
甚至文件名id_rsa也很重要。如果您将SSH密钥保存在另一个文件名或路径中,它将抛出Permission Denied(publickey)错误。