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

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

问题描述

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


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


在我看过的所有主题中,这里是我所做的:


  • 在我的计算机上设置一个SSH密钥并将公钥添加到GitLab中

  • 完成config --global的用户名和电子邮件
  • 通过SSH和HTTP进行克隆,以检查是否可以解决问题。

  • 完成ssh -T git@gitlab.com命令

>

现在我想打我的电脑。如果您有任何关于如何解决我的问题的见解,我们将不胜感激。

解决方案

我在搜索很多后发现此问题。它对我来说工作得很好。


  1. 像cmd一样转到Git Bash。右键单击并以以管理员身份运行。

  2. 输入 ssh-keygen

  3. 按回车。

  4. 它会要求您将密钥保存到特定目录。

  5. 按下回车键。它会提示你输入密码或输入密码。

  6. 公钥将被创建到特定目录。

  7. 现在转到目录并打开 .ssh 文件夹。

  8. 您将看到一个文件 id_rsa.pub 。在记事本上打开它。复制所有文本。

  9. 转到 https://gitlab.com/个人资料/密钥

  10. 现在点击下面的标题。然后点击添加密钥。

现在给它一枪,它会肯定工作。

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 :

  • Set up an SSH key on my computer and added the public key to GitLab
  • Done the config --global for username and email
  • Cloned via SSH and via HTTP to check if it would resolve the issue
  • Done the ssh -T git@gitlab.com command

Right now I want to punch my computer. If you have any insight about how to resolve my issue, it would be greatly appreciated.

解决方案

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

  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 .
  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天全站免登陆