有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,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目录吗?它应该有这样的内容:
Host github.com
IdentityFile ~/.ssh/github_rsa
假设您创建了一个名为github_rsa的ssh密钥
然后上传到GitHub…
注意:如果~/中有多个键(2个或更多),则必须采用这种显式配置方式。ssh /目录。如果你不这样指定密钥,那么第一个密钥将被用于github身份验证,因此它取决于密钥文件名。
其他回答
如果您已经创建了SSH密钥,但仍然报错,这是因为您需要给用户读写要克隆到的文件夹的权限。sudo chmod 777 <your_folder_name_here>"。 当然,这是在生成SSH密钥之后,仍然会得到这个错误。希望这对未来的用户有所帮助。
Edit
如果你使用git bash,在Windows中使用admin来添加
如果您正在使用GitHub for Mac UI,请检查首选项以确保您已登录。
我在AWS CodeCommit上也遇到了同样的问题。所有人都在一台笔记本电脑上工作,但另一台却没有。解决方案是在AWS配置部分的.ssh/config中删除'PreferredAuthentications publickey'行。
可能您的ssh-agent未启用 你可以试试
下载
http://git-scm.com/
安装它 使ssh-agent
C:\Program Files\Git\cmd
start-ssh-agent
首先,我们需要检查计算机上现有的ssh密钥。打开Terminal并运行:
ls -al ~/.ssh
#or
cd ~/.ssh
ls
这将列出.ssh目录下的文件
最后,根据你所看到的(对我来说是):
github_rsa github_rsa.pub known_hosts
试着设置你的RSA,希望这能解决你的“git推送源”问题
$ ssh-keygen -lf ~/.ssh/github_rsa.pub
注意:RSA证书是密钥配对,所以你会有一个私人和一个公共证书,私人将不会为你访问,因为它属于github(在这种情况下),但公共是一个你可能会错过当这个错误发生(至少是我的情况下,我的github帐户或回购搞砸了,我不得不“链接”公钥,以前生成)