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

我正在使用终端,我在根,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帐户时遇到问题,请按照以下步骤进行

解决方案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

其他回答

这种情况会发生在创建存储库后遵循GitHub指示时。Git将指示您使用以下内容添加遥控器。

Git远程添加源git@github.com:<用户>/<项目>.git

将<>中的内容替换为与您的帐户相关的值。

解决方案是删除.git后缀。添加遥控器的操作如下:

Git远程添加origin git@github.com:<用户>/<项目>

我试图用几个小时来解决类似的问题。最后,我删除了所有的密钥,并创建了没有密码的新密钥,最终摆脱了这个问题。

问题是SSH密码,需要删除!

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

确保SSH -add -l显示存在于Github帐户的SSH密钥列表中的SSH密钥的指纹。

如果输出为空,但你知道你有一个与你的github帐户一起使用的私有SSH密钥,在这个密钥上运行SSH -add(在~/. SSH中找到。默认情况下,它被命名为id_rsa,因此您可能会运行ssh-add id_rsa)。

否则,按照下面的说明生成SSH密钥对。

GitHub无法验证你的身份。所以,要么你没有安装SSH密钥,因为你还没有在你的机器上设置一个,要么你的密钥没有与你的GitHub帐户相关联。

您还可以使用HTTPS URL而不是SSH/git URL来避免必须处理SSH密钥。这是GitHub推荐的方法。

此外,GitHub有一个专门针对该错误消息的帮助页面,并更详细地解释了您可以检查的所有内容。