在 gitlab 上获得权限被拒绝(公钥) [英] Getting permission denied (public key) on gitlab
本文介绍了在 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.
- 转到Git Bash"就像cmd一样.右键单击并以管理员身份运行".
- 输入
ssh-keygen
- 按回车键.
- 它会要求您将密钥保存到特定目录.
- 按回车键.它会提示您输入密码或不输入密码.
- 将创建特定目录的公钥.
- 现在进入目录并打开
.ssh
文件夹. - 您将看到一个文件
id_rsa.pub
.在记事本上打开它.复制其中的所有文本. - 转到 https://gitlab.com/-/profile/keys 或李>
- 在此处粘贴key"文本字段.
- 现在点击标题";以下.它会自动被填满.
- 然后点击添加密钥".
- Go to "Git Bash" just like cmd. Right click and "Run as Administrator".
- Type
ssh-keygen
- Press enter.
- It will ask you to save the key to the specific directory.
- Press enter. It will prompt you to type password or enter without password.
- The public key will be created to the specific directory.
- Now go to the directory and open
.ssh
folder. - You'll see a file
id_rsa.pub
. Open it on notepad. Copy all text from it. - Go to https://gitlab.com/-/profile/keys or
- Paste here in the "key" textfield.
- Now click on the "Title" below. It will automatically get filled.
- Then click "Add key".
现在试一试,它肯定会起作用.
Now give it a shot and it will work for sure.
这篇关于在 gitlab 上获得权限被拒绝(公钥)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文