【问题标题】:Unable to Clone Gerrit Repository无法克隆 Gerrit 存储库
【发布时间】:2015-05-16 19:37:11
【问题描述】:

我正在尝试连接到我的 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

但是当我通过运行以下命令克隆存储库时

git clone ssh://<username>@<gerrit-server>:29418/project-name.git

我在我的 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.

我无法理解发生了什么以及如何在我的机器上成功克隆我的项目。有人可以帮我解决这个问题吗?

更新 1:

我仍然无法弄清楚问题是什么,但我只想分享一些现在正在发生的奇怪事情。我创建了另一个 SSH 密钥,这次我为 SSH 密钥添加了密码。我也在 SSH 服务器上添加了该密钥。通常,当密钥附加密码时,Git Bash 终端应要求输入密码以解锁私钥。
现在发生的事情是,如果我通过运行命令 SSH gerrit 服务器
ssh -p 29418 &lt;username&gt;@&lt;gerrit-server&gt; 它要求我解锁密码,这意味着它使用正确的 ssh 密钥并显示 Gerrit 欢迎消息
问题是当我运行上面列出的 git clone 命令时它不要求输入密码,这意味着它使用了其他一些 SSH 密钥,这就是我从 Gerrit 收到 SSH_exchange_identification 错误的原因。在克隆之前我还需要执行其他步骤吗?我是否必须进行任何 Git 设置才能成功克隆 Git 存储库?

【问题讨论】:

  • 用户名是否在设置屏幕的配置文件选项卡上配置为用户名? (如git.eclipse.org/r/Documentation/user-upload.html#test_ssh中提到的)
  • 是的用户名已配置,这就是为什么我在运行 ssh -p 29418 @ 后能够看到欢迎消息的原因
  • 我在 Gerrit Web 界面的“设置”屏幕的“配置文件”选项卡上输入用户名,而不是 ssh。
  • 是的,我已经配置了用户名,我正在使用该用户名
  • 尝试使用ssh -p 29418 &lt;username&gt;@&lt;gerrit-server&gt; gerrit ls-projects 并检查您的项目是否存在。如果没有,那么您需要更改您的访问权限。

标签: git gerrit git-bash


【解决方案1】:

配置你的 git 设置 -> config

添加user.nameemail(在您的gerrit 设置中使用)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-17
    • 2016-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-02
    • 2021-09-01
    相关资源
    最近更新 更多