gitlab - 如何修复 Permission denied (publickey) onGitlab?
问题描述
我在 Gitlab 上有一个项目,最近几天我一直在使用它!
但几天后,一切都过去了!我在 Gitlab 项目设置中添加了我的家用 PC ssh 密钥,但现在我想git pull
用于接收我家用 PC 中的新更改,向我显示此错误:
10:47 AM Update failed
Permission denied (publickey).
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
10:47 AM Update canceled
我该如何解决?
解决方案
GitHub 无法对您进行身份验证。所以,要么你没有设置 SSH 密钥,因为你没有在你的机器上设置一个,要么你的密钥没有与你的 GitHub 帐户相关联。
您还可以使用 HTTPS URL 而不是 SSH/git URL,以避免处理 SSH 密钥。这是 GitHub 推荐的方法。
此外,GitHub 有一个专门针对该错误消息的帮助页面,并更详细地解释了您可以检查的所有内容。
我知道这个问题。添加 ssh 密钥后,也将 ssh 密钥添加到 ssh 代理(来自官方文档https://help.github.com/articles/generating-ssh-keys/)
ssh-agent -s
ssh-add ~/.ssh/id_rsa
之后,一切正常,git可以查看正确的密钥,之前不能。
推荐阅读
- python-3.x - 'TypeError: 'CompositeModel' object is not callable' 尝试拟合复合模型时
- flutter - 有没有办法将用户锁定在应用程序内,除非输入密码,否则无法访问主屏幕
- java - java中String[]数据和String...数据有什么区别
- python - python字节到位字符串
- rest - .netcore 3 带有 HttpClient 的客户端证书
- python - 使用 Image Viewer (Eye of GNOME) 在一个目录中打开多个图像
- mysql - 创建索引时出现错误 1061 (MYSQL Workbench) 重复键
- java - Java:无法在尝试之外返回变量?
- prolog - 如何在序言中创建一个包含从 1 到 N 的元素的列表
- java - 使用自定义异常将函数转换为可完成的