有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,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自己的文档。
其他回答
我在远程主机上使用git pull寻找类似错误消息的解决方案时发现了这个页面:
$ git pull
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我通过ssh -AY remote_hostname从本地计算机连接到远程主机。这不是OP问题的解决方案,但对其他遇到这个页面的人很有用,所以把它贴在这里。
注意,在我的例子中,git pull在我的本地机器上工作良好(也就是说,ssh密钥已经设置,并添加到GitHub帐户等)。我通过将这个添加到~/来解决我的问题。Ssh /config在我的笔记本电脑:
Host *
ForwardAgent yes
然后我用ssh -AY remote_hostname重新连接到远程主机,git拉现在工作了。配置中的更改允许将我的ssh对从本地计算机转发到任何主机。ssh的-A选项实际上是在ssh会话中转发它。点击这里查看更多细节。
这发生在我身上。出于某种原因,我的出身在我没有意识到的情况下被搞砸了:
检查您的设置是否仍然正确
git remote -v
url需要像ssh://git@github.com/YourDirectory/YourProject.git; 如果没有看到git@github.com,请使用
git remote set-url origin git://github.com/YourDirectory/YourProject.git
纠正错误。或者你可以使用github应用程序在特定存储库的设置面板中检查和设置主远程存储库url。
首先,我们需要检查计算机上现有的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帐户或回购搞砸了,我不得不“链接”公钥,以前生成)
博士tl;
在~ /。ssh / config把
PubkeyAcceptedKeyTypes=+ssh-dss
场景 如果你使用的是openSSH > 7版本,比如在MacBook Pro的触控条上,它是ssh -V OpenSSH_7.4p1, LibreSSL 2.5.0
你也有一个旧的Mac,原来有你的密钥,你放在Github上,这是可能的,这是使用一个id_dsa密钥。OpenSSH v7没有在默认情况下使用这些DSA密钥(包括这个ssh-dss),但是您仍然可以通过将以下代码放入~/.ssh/config中来添加它
PubkeyAcceptedKeyTypes=+ssh-dss
对我有用的来源是这个Gentoo通讯
现在你至少可以使用GitHub,然后将密钥修复到RSA。
这招对我很管用:
1-删除所有起源
git remote rm origin
(参见https://www.kernel.org/pub/software/scm/git/docs/git-remote.html)
*remote: "管理你所跟踪的分支的存储库集合("remotes")。
*rm: "删除已命名的远程。所有远程跟踪分支和远程配置设置都被删除。”
2-检查所有已删除:
git remote -v
3-添加新的产地主
git remote add origin git@github.com:YOUR-GIT/YOUR-REPO.git
这就是所有的朋友们!