【问题标题】:Git clone produces bad packet length errorGit克隆产生错误的数据包长度错误
【发布时间】:2014-01-10 09:51:10
【问题描述】:

我无法在 Windows 上通过 ssh 提取 git 存储库。存储库位于 GitLab 服务器上。我执行以下步骤:

  1. ssh-keygen -t rsa -C "my@email.here"创建一个公钥
  2. 将密钥保存在C:\Users\myUserName\.ssh\keyName
  3. 运行ssh-agent的输出(即export SSH_AUTH_SOCK; ...)
  4. 运行ssh-add并将密钥添加到C:\Users\myUserName\.ssh\keyName
  5. 在 GitLab 中添加公钥。

相同的设置在我的 Linux 和我同事的 Windows 机器上运行良好。 当我尝试使用git clone 克隆存储库时,出现以下错误:

Disconnecting: Bad packet length 1397966893. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

我尝试用谷歌搜索,但没有找到合适的。有人知道我是否犯了错误或错误可能是服务器端的吗?

编辑:我得到以下调试输出:

C:\Users\Johannes\Documents\GitHub> ssh -vT -p 80 git@random.secret.sever.de
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /c/Users/Johannes/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to random.secret.sever.de [192.44.1.37] port 80.
debug1: Connection established.
debug1: identity file /c/Users/Johannes/.ssh/identity type -1
debug1: identity file /c/Users/Johannes/.ssh/id_rsa type 1
debug1: identity file /c/Users/Johannes/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
Disconnecting: Bad packet length 1397966893.

编辑 2:看起来我的问题是基于我的硬件和软件设置。只需并行执行相同的步骤,它就可以在另一台计算机上运行。

【问题讨论】:

  • 你是否验证了与 gitlab 的一般连接? (如果没有,你可以发出这个命令:ssh git@gitlab.com
  • 我得到以下输出:Warning: Permanently added 'gitlab.com,54.243.197.170' (RSA) to the list of known hosts. Permission denied (publickey).
  • 然后您需要将您的公钥添加到您的 GitLab 帐户。
  • 那么你的本地ssh设置配置不正确。
  • 我在 5) 中做到了 - 指纹也匹配

标签: git ssh gitlab


【解决方案1】:

偶然发现了我的问题的原因。我尝试使用一个旧技巧并启动系统恢复来撤消我的 Git 安装。由于我的病毒扫描程序,它失败了。卸载 Bitdefender Antivirus 免费版 后它工作了。传入的 SSH2 消息被阻止(获得 Windows 8 Pro),导致 bad packet length 错误。无论如何,感谢您的支持!

【讨论】:

  • 良好的反馈,比我最初的回答更准确。 +1
【解决方案2】:

将密钥保存在C:\Users\myUserName\.ssh\keyName

您的本地 ssh 命令会在 %HOME%\.ssh\id_rsa(.pub) 中查找 ssh 密钥。

所以你需要:

  • 重命名代表您的 ssh(公钥和私钥)的本地文件
  • 或通过%HOME%\.ssh\config 引用它们,它可以引用您的私钥的确切名称(使用IdentityFile directive)。

    Host gitlab 
    user git
    hostname your.gitlab.server.com
    IdentityFile C:\user\YourUsername\.ssh\keyName
    

在第二种情况下,ssh url 将是gitlab:yourRepo

【讨论】:

  • 如果你能看看我的编辑,我会很好,也许这会澄清我的问题。我在 Gitlab 中注册的密钥的名称是 id_rsa。提前致谢
  • @joschuck by "name" 我只说本地计算机中的文件名,而不是 GitLab 实例中注册的 ssh 密钥的名称。
  • 对不起,我就是这个意思,我语法不好。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-06-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多