GitLab:我无法推送或克隆 repo,要求提供 Git 密码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15974141/
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
GitLab: I can't push or clone repo, asking for Git password
提问by merp
I have installed latest GitLab with Bitnami. But I can't push my updates to central repo. It always asks for Git password. I installed it in a local server and given the domain name as a local IP. The public keys are updated in /hom/git/.ssh/authorised_keys list. Iut it asks for Git user password. Please, help me.
我已经用 Bitnami 安装了最新的 GitLab。但是我无法将更新推送到中央仓库。它总是要求输入 Git 密码。我将其安装在本地服务器上,并将域名作为本地 IP。公钥在 /hom/git/.ssh/authorised_keys 列表中更新。它要求输入 Git 用户密码。请帮我。
回答by Beltran
it is strange. Could you check that your SSH server is configured to use authorized_keys files?
它很奇怪。您能检查一下您的 SSH 服务器是否配置为使用 authorized_keys 文件吗?
/etc/ssh/sshd_config
PubkeyAuthentication yes
/etc/ssh/sshd_config
PubkeyAuthentication 是
Could you check the file permissions for the .ssh/authorized_keys file? The owner should be the git user. Did you already have a Gitlab version installed before? Maybe Gitolite is already installed and you need to use gitlab-shell for GitLab 5.
你能检查 .ssh/authorized_keys 文件的文件权限吗?所有者应该是 git 用户。您之前是否已经安装了 Gitlab 版本?也许 Gitolite 已经安装,你需要使用 GitLab 5 的 gitlab-shell。
回答by Iszuddin Ismail
I assumed that your git command is something like this
我假设你的 git 命令是这样的
git clone git@domain:project.git
or maybe
或者可能
sudo git clone git@domain:project.git
Sometimes we get mixed up with the user account that we are using. If we run sudo
, that means the command is being run as root. And did you create the SSH key for root and put it in Gitlab? In other case you probably created the SSH key using sudo ssh-keygen
but you run git normally, meaning the git command is running as the active user.
有时我们会混淆我们正在使用的用户帐户。如果我们运行sudo
,这意味着该命令正在以 root 身份运行。您是否为 root 创建了 SSH 密钥并将其放入 Gitlab?在其他情况下,您可能使用创建了 SSH 密钥,sudo ssh-keygen
但您正常运行 git,这意味着 git 命令以活动用户身份运行。
We may also get mixed up with the SSH key that we put inside Gitlab.
我们也可能会与我们放在 Gitlab 中的 SSH 密钥混淆。
Not sure if you need this yet, but if you use web hook, in Ubuntu the Apache is normally running as www-data. So for web hook to work, you would need to create SSH key for the www-data user.
不确定你是否需要这个,但如果你使用 web hook,在 Ubuntu 中,Apache 通常作为 www-data 运行。因此,要使网络挂钩正常工作,您需要为 www-data 用户创建 SSH 密钥。
回答by John
I just setup gitlab yesterday on a virtual machine (xenserver) and ubuntu server 12.x LTS. I had the same exact issue.
我昨天刚刚在虚拟机(xenserver)和 ubuntu 服务器 12.x LTS 上设置了 gitlab。我有同样的问题。
I set my ssh keys and all that, still nothing.
我设置了我的 ssh 密钥和所有这些,仍然没有。
I did 2 things, not sure if one or both fixed it...
我做了两件事,不确定其中一项或两项是否修复了它...
First, I installed git (!). I just assumed it would come with gitlab, but it didn't.
首先,我安装了 git (!)。我只是假设它会随 gitlab 一起提供,但事实并非如此。
sudo apt-get install git
When you install gitlab, it creates a user 'git', though, it doesn't show up in the home dir.
当您安装 gitlab 时,它会创建一个用户“git”,但它不会显示在主目录中。
I set a password for git user:
我为 git 用户设置了密码:
sudo passwd git
I restart the machine after that. I was then able to push / pull like so:
之后我重新启动机器。然后我就可以像这样推/拉:
git clone [email protected]:test-group/test-repo.git
I want to use git / gitlab to deploy automatic and remote updates for many, many machines at remote locations. I still can't figure out how to do it. I thought you could create a user in gitlab and push/pull based off that users permissions but I can't seem to figure out how to do it.
我想使用 git / gitlab 为远程位置的许多机器部署自动和远程更新。我仍然不知道该怎么做。我以为您可以在 gitlab 中创建一个用户并根据该用户的权限进行推/拉,但我似乎无法弄清楚该怎么做。
Good luck!
祝你好运!