GitLab 需要 git@localhost 密码才能推送到仓库 [英] GitLab requires git@localhost password to push to a repo

查看:26
本文介绍了GitLab 需要 git@localhost 密码才能推送到仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让 GitLab 在我的服务器上启动并运行.我按照 gitlab github 页面上的安装说明进行操作,一切顺利.

I'm trying to get GitLab up and running on my server. I followed the installation instructions at the gitlab github page and everything went well.

问题是,当我创建一个 repo 并尝试

The issue is, when I create a repo and try to

sudo git push -u origin master

系统提示我输入git@localhost 的密码:"

I am prompted for 'git@localhost's password: '

git用户没有密码,所以这是个问题.

The git user doesn't have a password, so this is a problem.

其他遇到此问题的人建议在我的 sshd conf 中将 git 添加到 AllowedUsers,但我没有 AllowedUsers 字段,所以这似乎不是问题.

Other people who have run into this problem suggested adding git to AllowedUsers in my sshd conf but I don't have an AllowedUsers field in there, so that doesn't seem to be an issue.

我对 ssh 的东西还是很陌生,所以我相信这是某种 ssh 密钥问题,尽管我尝试将所有相关的 ssh 密钥添加到/home/git/.ssh/authorized_keys 并验证没有换行符在文件中.

I'm still pretty new to ssh stuff so I believe its some sort of ssh key issue, though I tried to add all relevant ssh keys to /home/git/.ssh/authorized_keys and verified that there are no line breaks in the file.

仅供参考,我的安装完全通过了 gitlab wiki 中提供的测试:

Just FYI, my install completely passes the test provided in the gitlab wiki:

sudo -u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production

非常感谢任何建议!

编辑

所以,我终于通过从另一台机器提交一个 repo 来解决这个问题.事实上,我被 SSH 连接到运行 gitlab 的同一台机器上.当我尝试从主机以外的机器提交时,它工作得很好.因此,对于某些人来说,这可能是一个解决方案(对于我们来说,因为我们在单独的机器上开发而不是在我们的服务器上开发).

So, I finally got around this by just committing to a repo from a different machine. As it was, I was SSHed into the same machine that gitlab was running on. As soon as I tried to commit from a machine other than the host, it worked great. So, that may be a solution for some people (it is for us, since we develop on seperate machines than our servers).

对于任何试图在同一台机器上进行托管和开发但遇到此问题的人来说,这仍然是一个开放式问题.

This is still an open-ended issue for anyone trying to host and develop on the same machine who has run into this.

推荐答案


TL;DR


TL;DR

密钥存储在 gitlab DB 和 gitolite 端.您应该使用工厂构建的 gitolite-admin.git 文件夹,不要使用您的备份!稍后使用 update keys 命令重建 gitolite 的密钥.(将已保存在 gitlab db 中的那些密钥更新​​为 gitolite)

Keys store on both gitlab DB and gitolite side. You should use the factory build gitolite-admin.git folder, don't use your backup! And rebuild the Keys for gitolite later with the update keys command. (update those keys already saved inside the gitlab db to gitolite)

sudo -u gitlab -H bundle exec rake gitlab:gitolite:update_keys RAILS_ENV=production

<小时>

很可能是因为 gitolite 密钥无法正确保存的问题.这些密钥(用于登录)实际上由 gitlab &石榴石.对于拉/推实际上是使用保存在 gitolite 中的键.(git/repositories/gitolite-admin.git/index, git/.gitolite/keydir, git/.ssh/authorized_keys)


Most likely it's because there is something issue about the gitolite keys not save properly. Those keys (for login) are actually keep separately by gitlab & gitolite. For pull/push is actually using the keys saved inside gitolite. (git/repositories/gitolite-admin.git/index, git/.gitolite/keydir, git/.ssh/authorized_keys)

gitlab 通常应该帮助将那些在网络上导入的密钥保存到 gitolite 文件中.然而,由于某些原因,它失败了.由于密钥没有正确保存在 gitolite 中,客户端/服务器无法使用密钥并回退到密码.

gitlab normally should help on saving those imported keys on web to the gitolite files. However, for some reasons it failed. As the keys are not saved properly inside gitolite, the client/server fail to use the keys and fallback to password.

您必须检查并修复保存在 gitolite 中的那些密钥以纠正问题.

You have to check and fix those keys saved inside gitolite to correct the problems.

查看更多https://groups.google.com/forum/?fromgroups=#!topic/gitlabhq/X0z_9l7L7A8

这篇关于GitLab 需要 git@localhost 密码才能推送到仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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