git 将 ssh 密钥添加到 gitlab
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22411442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding ssh key to gitlab
提问by Pedro G.
I installed Gitlab on a Fedora 17 server following thisguide and I believe everything works fine, except that I cannot add ssh keys or push my local repository to the server.
我按照本指南在 Fedora 17 服务器上安装了 Gitlab ,我相信一切正常,除了我无法添加 ssh 密钥或将我的本地存储库推送到服务器。
When trying to add a SSH key via the web interface I get the message "Fingerprint cannot be generated"
尝试通过 Web 界面添加 SSH 密钥时,我收到消息“无法生成指纹”
When I try to push the local repo to the server with
当我尝试将本地仓库推送到服务器时
git remote add origin git@myserver:user/repo.git
git push -u origin master
It asks me for the password of the git user, which I cannot introduce since it does not have one. How can I fix this? I've tried to search the logs for debugging information but could not find anything.
它要求我提供 git 用户的密码,我无法介绍,因为它没有。我怎样才能解决这个问题?我试图在日志中搜索调试信息,但找不到任何东西。
edit: I've tried adding my public rsa key to authorized_keys and I can ssh without entering the password (the session closes because login is disabled for this user). However, when I try to push origin master I get the following
编辑:我已经尝试将我的公共 rsa 密钥添加到 authorized_keys 并且我可以在不输入密码的情况下进行 ssh(会话关闭,因为该用户的登录被禁用)。但是,当我尝试推送 origin master 时,我得到以下信息
fatal: protocol error: bad line length character: This
采纳答案by Pritam Baral
About the "Fingerprint cannot be generated"
: GitLab needs access to /tmp for generating fingerprints, and SELinux might be preventing that. Relevant Discussion on GitHub
关于"Fingerprint cannot be generated"
:GitLab 需要访问 /tmp 来生成指纹,而 SELinux 可能会阻止这种情况。GitHub上的相关讨论
回答by Vlad
You have to use OpenSSH version of key.
您必须使用 OpenSSH 版本的密钥。
Under *Linux you can get this version of key with command: ssh-keygen -i -f /tmp/id_rsa.pub >>
在 *Linux 下,您可以使用以下命令获取此版本的密钥:ssh-keygen -i -f /tmp/id_rsa.pub >>
Under Windows you can use Pyttygen application: open your key, then menu Conversions -> export OpenSSH key.
在 Windows 下,您可以使用 Pyttygen 应用程序:打开您的密钥,然后菜单转换 -> 导出 OpenSSH 密钥。
I guess it helps you :)
我想它可以帮助你:)