有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,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.
当前回答
我也遇到了这个问题,因为我使用了几个GIT帐户,以及工作和大学的不同帐户,这对我来说很有效:
->进入您的SSH配置
cd ~/.ssh/
vim config
->复制下面的块,并填写您想要推送到/with的主机和用户
Host [Hostname]
User [User]
PubkeyAcceptedAlgorithms +ssh-rsa
HostkeyAlgorithms +ssh-rsa
我得到这个问题的几个主机名,所以现在我有几个这些配置在我的ssh配置文件。
其他回答
我在ssh代理中加载了2个Github身份文件。我的个人钥匙和另一把客户项目的钥匙。
我删除了引起混乱的关键:
Ssh-add -d id_rsa_github_somekey . sh
同样在ubuntu中,即使在BitBucket的设置中已经输入了SSH密钥,我还是遇到了这个问题。原因是,我尝试了以下几点:
sudo git push origin master
不知道为什么,但它解决了使用
git push origin master
没有使用sudo。
我想我有最好的答案给你,你的git应用程序读取你的id_rsa。根用户目录下的Pub
/home/root/.ssh/id_rsa.pub
这就是为什么你的密钥在/home/your_username/.ssh/id_rsa中。少年犯看不懂酒吧。因此,您需要在/home/root/.ssh/中创建密钥
$ sudo su
$ ssh-keygen
$ cd ~/.ssh
$ cat id_rsa.pub
然后复制密钥在你的github帐户。 这对我很有效。你可以试试。
排除故障的步骤
这发生在SourceTree上 在我的例子中,我的公私钥对出了问题。所以我删除这对并生成一个新的来解决我的问题
在将GitHub添加为远程时,使用该页面的URL。 它不会引起任何这样的错误和推动代码