有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,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 push'期间得到相同的错误。在客户端,我有两个起源和主人。我拿掉了一个,然后它就正常工作了。
其他回答
如果您已经创建了SSH密钥,但仍然报错,这是因为您需要给用户读写要克隆到的文件夹的权限。sudo chmod 777 <your_folder_name_here>"。 当然,这是在生成SSH密钥之后,仍然会得到这个错误。希望这对未来的用户有所帮助。
Edit
如果你使用git bash,在Windows中使用admin来添加
转到你的GitHub账户仪表板,找到你的项目存储库,单击设置选项卡-在部署密钥下,你必须添加你的SSH密钥。打开终端和类型:
cat ~/.ssh/id_rsa.pub | pbcopy
这将从id_rsa复制密钥。酒吧文件。回到GitHub仪表板,粘贴,点击添加键,就是这样。
同样的解决方案也适用于Bitbucket账户。
以防有人需要这个。我在用户的.ssh文件夹中创建了一个不同名称的ssh密钥,如ar-2022-ssh。这样做的问题是,检查现有的SSH密钥指定GitHub支持的公钥是以下之一。
id_rsa.pub
id_ecdsa.pub
id_ed25519.pub
一旦我在生成密钥时将我的ssh密钥名称更改为其中之一,它就可以连接到GitHub
我想我有最好的答案给你,你的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帐户。 这对我很有效。你可以试试。
这招对我很管用:
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
这就是所有的朋友们!