如何克隆损坏的git仓库

问题描述 投票:2回答:1

我尝试克隆回购时得到的错误:

$ git clone [email protected]:project.git
Cloning into 'project'...
remote: fatal: empty filename in tree entry
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: index-pack failed

有办法解决这个问题吗?

git
1个回答
2
投票

如果没有对服务器的管理访问权限或干净的副本,那么您可以做的很少。但是,由于您认为损坏会影响最近的一些提交,您可以尝试克隆另一个分支,看看是否有效。

首先,让我们看看可以克隆的内容:

git ls-remote [email protected]:project.git

这应该为您提供服务器上可用的引用列表。找到候选人后,尝试克隆它

git clone --single-branch --branch refname [email protected]:project.git
© www.soinside.com 2019 - 2024. All rights reserved.