有人看到这个错误并知道该怎么做吗?

我正在使用终端,我在根,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密钥。不知道这是否真的有用。总之,这是最后成功的方法:

使用git远程将远程的URL从HTTPS更改为SSH set-url命令。$ git remote set-url origin git@github.com:USERNAME/REPOSITORY.git。验证远程URL 已经改变了。

其他回答

允许对密钥(标识)进行写访问,然后单击“添加密钥”

如果在Windows上,请检查通过SSH使用Github中的更多详细信息。

你需要生成一个SSH密钥(如果你没有的话),并将公钥与你的Github帐户相关联。参见Github自己的文档。

这可能是由于您的SSH密钥/ GPG需要在您的组织github或gitbucket站点上更新。 遵循以下步骤来鞋底:

在cmd:键入>> $ ssh-keygen -t rsa -C "your_email@example.com"(结果创建id_rsa和id_rsa.pub) $ ssh-add ~/.ssh/id_rsa 猫~ / . ssh / id_rsa。Pub并复制密钥,然后到你的org bitbucket/ github站点,并将其粘贴到SSH密钥上

我想补充一些我的发现:

如果您正在使用GitBash,那么请确保SSH密钥存储在~/. SSH /id_rsa中。

默认情况下,git会搜索~/。ssh/id_rsaas ssh密钥的默认路径。

甚至文件名id_rsa也很重要。如果您将SSH密钥保存在另一个文件名或路径中,它将抛出Permission Denied(publickey)错误。

如果您在连接您的企业Github帐户时遇到问题,请按照以下步骤进行

解决方案1

ERROR: git@github.com: Permission denied (public key). fatal: Could not read
from remote repository. Please make sure you have the correct access
rights

解决方案(OSX)

打开终端并执行以下命令 $ CD ~ $ sudo su ssh - keygen美元 输入要保存密钥的文件(/var/root/.ssh/id_rsa): $ id_rsa Enter passphrase(空表示没有passphrase): $ hit Enter 再次输入相同的密码:$ hit Enter $ CD ~/.ssh $ cat id_rsa.pub 复制显示内容。 打开GitHub单击您的配置文件图标设置>SSH和GPC密钥 单击新的ssh键按钮 输入您复制的任何标题和键 检查您的问题是否已经解决

解决方案2

ERROR 2: remote: Password authentication is not available for Git operations.
remote: You must use a personal access token or SSH key.
remote: See https://github.compnay.com/settings/tokens or https://github.compnay.com/settings/ssh
fatal: unable to access 'https://github.company.com/repo/app.git/': The requested URL returned an error: 403

密码认证支持已于2021年8月13日移除。请改用个人访问令牌。

https://namespaceit.com/blog/remote-support-for-password-authentication-was-removed-on-august-13-2021-please-use-a-personal-access-token-instead