Has*_*lvi 5 git gerrit git-bash
我正在尝试连接到我的 VPS 上托管的 gerrit。我正在使用 Windows 版 Git Bash。我在 GitBash 中使用 ssh-keygen 生成了 SSH 密钥,并在 gerrit 服务器上添加了密钥。当我运行时,ssh -p 29418 <username>@<gerrit-server>我会看到下面的欢迎消息
**** Welcome to Gerrit Code Review ****
Hi Full Name, you have successfully connected over SSH.
Unfortunately, interactive shells are disabled.
To clone a hosted Git repository, use:
git clone ssh://username@<gerrit-server>:29418/REPOSITORY_NAME.git
Run Code Online (Sandbox Code Playgroud)
但是当我通过运行以下命令克隆存储库时
git clone ssh://<username>@<gerrit-server>:29418/project-name.git
Run Code Online (Sandbox Code Playgroud)
我在 Git Bash 终端中看到以下错误
Cloning into 'project-name'...
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
我无法理解发生了什么以及如何在我的机器中成功克隆我的项目。有人可以在这件事上帮助我吗?
Update-1:
我仍然无法弄清楚问题是什么,但我只想分享一些现在正在发生的奇怪的事情。我创建了另一个 SSH 密钥,这次我为 SSH 密钥添加了密码。我也在 SSH 服务器上添加了该密钥。通常,当密钥附加有密码时,Git Bash 终端应要求输入密码来解锁私钥。
现在发生的事情是,如果我通过运行命令 ssh gerrit 服务器,ssh -p 29418 <username>@<gerrit-server>它会要求我解锁密码,这意味着它使用正确的 ssh 密钥,并且会显示 Gerrit 欢迎消息
问题是,当我运行时它不会要求输入密码上面列出的 git clone 命令,这意味着它使用其他一些 SSH 密钥,这就是我SSH_exchange_identification从 Gerrit 收到错误的原因。在克隆之前我还需要执行其他步骤吗?我是否需要进行任何 Git 设置才能成功克隆 Git 存储库?