在 gitlab 上获取权限被拒绝(公钥) [英] Getting permission denied (public key) on gitlab

查看:72
本文介绍了在 gitlab 上获取权限被拒绝(公钥)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我无法从 GitLab 推送或获取.但是,我可以克隆(通过 HTTP 或通过 SSH).当我尝试推送时出现此错误:

My problem is that I can't push or fetch from GitLab. However, I can clone (via HTTP or via SSH). I get this error when I try to push :

权限被拒绝(公钥)致命:无法从远程存储库读取

Permission denied (publickey) fatal : Could not read from remote repository

从我看过的所有线程来看,这是我所做的:

From all the threads I've looked, here is what I have done :

  • 在我的电脑上设置一个 SSH 密钥并将公钥添加到 GitLab
  • 为用户名和电子邮件完成配置 --global
  • 通过 SSH 和 HTTP 克隆以检查是否可以解决问题
  • 完成 ssh -T git@gitlab.com 命令

如果您对如何解决我的问题有任何见解,将不胜感激.

If you have any insight about how to resolve my issue, it would be greatly appreciated.

推荐答案

我找了很多遍才找到这个.对我来说完全没问题.

I found this after searching a lot. It will work perfectly fine for me.

  1. 转到Git Bash"就像cmd一样.右键单击并以管理员身份运行".
  2. 输入ssh-keygen
  3. 按回车键.
  4. 它会要求您将密钥保存到特定目录.
  5. 按回车键.它会提示您输入密码或不输入密码.
  6. 公钥将创建到特定目录.
  7. 现在转到目录并打开 .ssh 文件夹.
  8. 您将看到一个文件 id_rsa.pub.在记事本上打开它.从中复制所有文本.
  9. 转到https://gitlab.com/-/profile/keys 或莉>
  10. 在此处粘贴键";文本字段.
  11. 现在点击标题"以下.它会自动填满.
  12. 然后点击添加密钥".
  1. Go to "Git Bash" just like cmd. Right click and "Run as Administrator".
  2. Type ssh-keygen
  3. Press enter.
  4. It will ask you to save the key to the specific directory.
  5. Press enter. It will prompt you to type password or enter without password.
  6. The public key will be created to the specific directory.
  7. Now go to the directory and open .ssh folder.
  8. You'll see a file id_rsa.pub. Open it on notepad. Copy all text from it.
  9. Go to https://gitlab.com/-/profile/keys or
  10. Paste here in the "key" textfield.
  11. Now click on the "Title" below. It will automatically get filled.
  12. Then click "Add key".

现在试一试,它肯定会起作用.

Now give it a shot and it will work for sure.

这篇关于在 gitlab 上获取权限被拒绝(公钥)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆