简体   繁体   English

GIT - 无法克隆或提取存储库(错误输出)

[英]GIT - cannot clone or pull repository (error output)

i have a problem with cloning/pulling some of GIT repositories.我在克隆/提取一些 GIT 存储库时遇到问题。 Most of repositories work correctly, but biggest one (commit count - we convert our two years old tfs project to GIT repositories) dont work.大多数存储库都可以正常工作,但最大的一个(提交计数 - 我们将两年前的 tfs 项目转换为 GIT 存储库)不起作用。

Clone error:克隆错误:

git -c filter.lfs.smudge= -c filter.lfs.required=false -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks clone --branch master PROJECTPATHPLACEHOLDER.git C:\Workspace\GIT\PROJECTNAME Cloning into 'C:\Workspace\GIT\PROJECTNAME'... error: RPC failed; git -c filter.lfs.smudge= -c filter.lfs.required=false -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks clone --branch master PROJECTPATHPLACEHOLDER.git C:\ Workspace\GIT\PROJECTNAME 克隆到 'C:\Workspace\GIT\PROJECTNAME'... 错误:RPC 失败; curl 56 Recv failure: Connection was reset fatal: error reading section header 'shallow-info' curl 56 接收失败:连接已重置致命:错误读取部分 header '浅信息'

Pull error:拉取错误:

RPC failed; RPC 失败; curl 56 Recv failure: Connection was reset Git failed with a fatal error. curl 56 接收失败:连接已重置 Git 因致命错误而失败。 error reading section header 'acknowledgments'错误读取部分 header '致谢'

I try google possible solution, but none helped (increase http.postbuffer, different versions).我尝试了谷歌可能的解决方案,但没有任何帮助(增加 http.postbuffer,不同的版本)。 I tried diferent version of the GIT (2.21,2.27,2.29), different environment for git (GIT cmd, Microsoft Visual Studio Professional 2019 Version 16.8.0, Sourcetree 3.3.9) with same error output. I tried diferent version of the GIT (2.21,2.27,2.29), different environment for git (GIT cmd, Microsoft Visual Studio Professional 2019 Version 16.8.0, Sourcetree 3.3.9) with same error output.
We using BitBucket server as a git server.我们使用 BitBucket 服务器作为 git 服务器。 My configuration is laptop, win10 pro, remote over vpn.我的配置是笔记本电脑,win10 pro,通过vpn远程。

I will be glad for any a help.我会很高兴有任何帮助。 Thanks, Lukáš Vašek谢谢,卢卡什·瓦谢克

Ps.附言。 If there is any ambiguity, ask me for specification.如果有任何歧义,请询问我的规范。

We found the solution for that problem.我们找到了解决该问题的方法。 There was some kind of a filter at VPN firewall (checkPoint), which blocked git http requests sometimes. VPN 防火墙 (checkPoint) 上有某种过滤器,有时会阻止 git http 请求。

I solved this same problem using the command:我使用以下命令解决了同样的问题:

git clone --depth 20 <repo>

Reference:参考:

https://git-scm.com/docs/shallow https://git-scm.com/docs/shallow

More about this:更多关于这个:

git shallow clone (clone --depth) misses remote branches git 浅克隆(clone --depth)错过远程分支

Considering anything related to shallow info comes from Git 2.18, Q2 2019 ( commit 685fbd32916f3e94bc89aa14e8fdce835b06f801 ), maybe an older Git would ignore that header section entirely. Considering anything related to shallow info comes from Git 2.18, Q2 2019 ( commit 685fbd32916f3e94bc89aa14e8fdce835b06f801 ), maybe an older Git would ignore that header section entirely.

If not, I would first check if that repository can be cloned in any other environment (meaning on a Linux machine, still accessed through VPN, but local to the company network)如果不是,我将首先检查该存储库是否可以在任何其他环境中克隆(即在 Linux 机器上,仍通过 VPN 访问,但在公司网络本地)


Note this error message can disappear with Git 2.37 (Q3 2022) in some cases:请注意,在某些情况下,此错误消息可能会随着 Git 2.37(2022 年第三季度)消失:

" git fetch " ( man ) unnecessarily failed when an unexpected optional section appeared in the output, which has been corrected with Git 2.37 (Q3 2022).当 output 中出现意外的可选部分时,“ git fetchman不必要地失败了,该问题已通过 Git 2.37 得到纠正(Q

See commit 7709acf (16 May 2022) by Jonathan Tan ( jhowtan ) .请参阅Jonathan Tan ( jhowtan )提交 7709acf (2022 年 5 月 16 日)。
(Merged by Junio C Hamano -- gitster -- in commit 9cf4e0c , 25 May 2022) (由Junio C Hamano -- gitster --提交 9cf4e0c中合并,2022 年 5 月 25 日)

fetch-pack : make unexpected peek result non-fatal fetch-pack :使意外的偷看结果非致命

Signed-off-by: Jonathan Tan签字人:Jonathan Tan

When a Git server responds to a fetch request, it may send optional sections before the packfile section.当 Git 服务器响应 fetch 请求时,它可能会在 packfile 部分之前发送可选部分。
To handle this, the Git client calls packet_reader_peek() (see process_section_header() ) in order to see what's next without consuming the line.为了处理这个问题,Git 客户端调用packet_reader_peek() (参见process_section_header() )以便在不消耗线路的情况下查看下一步。

However, as implemented, Git errors out whenever what's peeked is not an ordinary line.但是,在实施时,只要看到的不是普通的线,Git 就会出错。
This is not only unexpected (here, we only need to know whether the upcoming line is the section header we want) but causes errors to include the name of a section header that is irrelevant to the cause of the error.这不仅出乎意料(在这里,我们只需要知道即将到来的行是否是我们想要的 header 部分),而且会导致错误包含与错误原因无关的部分 header 的名称。

For example, at $DAYJOB , we have seen " fatal: error reading section header 'shallow-info' " error messages when none of the repositories involved are shallow.例如,在$DAYJOB中,当所涉及的存储库都不是浅层时,我们会看到“ fatal: error reading section header 'shallow-info' ”错误消息。

Therefore, fix this so that the peek returns 1 if the upcoming line is the wanted section header and nothing else.因此,修复此问题,如果即将到来的行是想要的部分 header 而不是其他的,则 peek 返回 1。
Because of this change, reader->line may now be NULL later in the function, so update the error message printing code accordingly ( expected '%s', received '%s' or expected '%s' ).由于此更改, reader- reader->line现在可能是NULL中的 NULL,因此相应地更新错误消息打印代码( expected '%s', received '%s'expected '%s' )。

Depending on the network configuration, cloning over HTTPS may fail with the error: reading section header 'shallow-info' .根据网络配置,通过 HTTPS 克隆可能会失败并出现错误:读取部分 header 'shallow-info' I had a similar scenario: Bitbucket + Git repository converted from SVN, with a long history.我有一个类似的场景:Bitbucket + Git 存储库从 SVN 转换而来,历史悠久。

I managed to clone the repository using SSH.我设法使用 SSH 克隆了存储库。 At first, it was hanging.起初,它是挂着的。 To fix it, I had to reupload the repository after I ran garbage collection:为了修复它,我必须在运行垃圾收集后重新上传存储库:

  • git fsck git fsck
  • git gc --prune="0 days" git gc --prune="0 天"

Cloning over HTTPS was still failing, though.不过,通过 HTTPS 克隆仍然失败。

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

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