有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,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.
当前回答
首先,我们需要检查计算机上现有的ssh密钥。打开Terminal并运行:
ls -al ~/.ssh
#or
cd ~/.ssh
ls
这将列出.ssh目录下的文件
最后,根据你所看到的(对我来说是):
github_rsa github_rsa.pub known_hosts
试着设置你的RSA,希望这能解决你的“git推送源”问题
$ ssh-keygen -lf ~/.ssh/github_rsa.pub
注意:RSA证书是密钥配对,所以你会有一个私人和一个公共证书,私人将不会为你访问,因为它属于github(在这种情况下),但公共是一个你可能会错过当这个错误发生(至少是我的情况下,我的github帐户或回购搞砸了,我不得不“链接”公钥,以前生成)
其他回答
如果您在连接您的企业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无法验证你的身份。所以,要么你没有安装SSH密钥,因为你还没有在你的机器上设置一个,要么你的密钥没有与你的GitHub帐户相关联。
您还可以使用HTTPS URL而不是SSH/git URL来避免必须处理SSH密钥。这是GitHub推荐的方法。
此外,GitHub有一个专门针对该错误消息的帮助页面,并更详细地解释了您可以检查的所有内容。
同样在ubuntu中,即使在BitBucket的设置中已经输入了SSH密钥,我还是遇到了这个问题。原因是,我尝试了以下几点:
sudo git push origin master
不知道为什么,但它解决了使用
git push origin master
没有使用sudo。
使用Https是可以的,运行git config——global credential。帮助wincred创建一个Github凭据帮助存储您的凭据为您。如果这不起作用,那么您需要编辑.git目录中的配置文件,并将原始文件更新为https url。
查看github文档的链接。
如果您正在使用windows -10,请遵循此说明。这对我很管用。
以管理员身份打开终端 执行命令:"ssh-keygen"。它生成一个ssh密钥,并显示创建密钥的文件夹。检查我的图像 复制生成的ssh密钥 点击“新建SSH键按钮”并粘贴“SSH键”,最后“点击添加按钮”