简体   繁体   English

gitlab: git clone ssh 仍然提示输入密码,ssh -T 正在工作

[英]gitlab: git clone ssh still prompts for password, ssh -T is working

I am aware of all the questions regarding SSH login to a gitlab instance still prompting for a password, but none of the answers describes what I am experiencing.我知道有关 SSH 登录到 gitlab 实例的所有问题仍然提示输入密码,但没有一个答案描述了我的经历。

Expected behavior: git clone works without prompting for a password, since it uses the stored SSH key to authorize against a running gitlab instance.预期行为:git clone 在不提示输入密码的情况下工作,因为它使用存储的 SSH 密钥对正在运行的 gitlab 实例进行授权。

Actual behavior: I get a password prompt for user "git" instead of cloning the repo.实际行为:我收到用户“git”的密码提示,而不是克隆 repo。

I am trying to clone a git repo on windows using Git bash from my own gitlab instance, but I still get prompted for a password despite the fact, that ssh -T git@host:port/path/to/repo.git is working properly.我正在尝试使用来自我自己的 gitlab 实例的 Git bash 在 Windows 上克隆一个 git repo,但我仍然收到输入密码的提示,尽管ssh -T git@host:port/path/to/repo.git正在工作适当地。

$ ssh -T git@xxx.xxx.xxx.xxx -p 12345
Welcome to GitLab, @User!

I did the following steps:我做了以下步骤:

  1. create a SSH key pair, upload public key to gitlab创建 SSH 密钥对,将公钥上传到 gitlab
  2. open git bash (windows) and test the SSH connection using ssh -T打开 git bash (windows) 并使用ssh -T测试 SSH 连接
  3. try to clone the repo (using the same git bash) with the following command: git clone --progress -v "ssh://git@host:port/path/to/repo.git"尝试使用以下命令克隆 repo(使用相同的 git bash): git clone --progress -v "ssh://git@host:port/path/to/repo.git"

eval 'ssh-agent' returns a PID, I even tried ssh-add to add the SSH identiy again. eval 'ssh-agent'返回一个 PID,我什至尝试ssh-add再次添加 SSH 身份。 But since the SSH connection is working properly, the problem seems to be the git clone command which simply ignores my SSH identity.但是由于 SSH 连接工作正常,问题似乎是git clone命令,它只是忽略了我的 SSH 身份。 If the gitlab server was the problem, ssh -T should not work, right?如果 gitlab 服务器是问题所在, ssh -T应该不起作用,对吗?

What am I missing here?我在这里缺少什么?

Found the solution myself.自己找到了解决办法。 Had a long forgotten but still active TortoiseGit installation from medieval times.从中世纪有一个早已被遗忘但仍然活跃的 TortoiseGit 安装。 That was messing with the $GIT_SSH environment variable, leading to the use of TortoisePlink and thus ignoring my local .ssh config for git bash.这与$GIT_SSH环境变量混淆,导致使用 TortoisePlink 并因此忽略了我本地的 .ssh git bash 配置。

After removing TortoiseGit everything is working as expected.删除 TortoiseGit 后,一切都按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM