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

我正在使用终端,我在根,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密钥,输入SSH -keygen -t rsa -C "your_email@example.com"这将创建id_rsa和id_rsa。酒吧的文件。

将id_rsa添加到本地计算机的ssh列表:ssh- Add ~/.ssh/id_rsa。

生成密钥后获取pubkey使用:

cat ~/.ssh/id_rsa.pub 

你会得到这样的东西:

cat ~/.ssh/id_rsa.pub 

ssh-rsa AAAB3NzaC1yc2EAAAADAQABAAACAQCvMzmFEUPvaA1AFEBH6zGIF3N6pVE2SJv9V1MHgEwk4C7xovdk7Lr4LDoqEcqxgeJftwWQWWVrWWf7q9qCdHTAanH2Q5vx5nZjLB+B7saksehVOPWDR/MOSpVcr5bwIjf8dc8u5S8h24uBlguGkX+4lFJ+zwhiuwJlhykMvs5py1gD2hy+hvOs1Y17JPWhVVesGV3tlmtbfVolEiv9KShgkk3Hq56fyl+QmPzX1jya4TIC3k55FTzwRWBd+IpblbrGlrIBS6hvpHQpgUs47nSHLEHTn0Xmn6Q== user@email.com

复制这个密钥(值),到github.com,在设置(ssh和PGP密钥)下添加您的公钥。

其他回答

这对我很有用

有2个选项在github - HTTPS/SSH

我错误地选择了SSH,因此出现了错误-_-

切换到HTTPS,然后复制url再次尝试:)

TLDR:

确保您拥有对回购的写访问权限(从回购的设置中进行配置)。 确保公钥在你的github帐户的SSH和GPG密钥中。

对我来说,这个错误通常发生在我试图从新安装的机器上克隆一些repo时。当收到请求时,github将首先检查公钥哈希。如果公钥不匹配任何用户,github将拒绝此请求。如果机器是新的,并且您的ssh密钥是新生成的,则这种情况很常见。

如果您将ssh访问更改为https访问远程存储库,问题就解决了:

git remote set-url origin https_link_to_repository

git push -u origin master

如果您正在使用windows -10,请遵循此说明。这对我很管用。

以管理员身份打开终端 执行命令:"ssh-keygen"。它生成一个ssh密钥,并显示创建密钥的文件夹。检查我的图像 复制生成的ssh密钥 点击“新建SSH键按钮”并粘贴“SSH键”,最后“点击添加按钮”

如果您在连接您的企业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