我尝试克隆存储库时遇到的错误:
$ git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a0c7c9d4e0d2c5d0cf8ed8d88ed8d88ec3cfcd" rel="noreferrer noopener nofollow">[email protected]</a>: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 ls-remote <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ccaba5b88cbea9bca3e2b4b4e2b4b4e2afa3a1" rel="noreferrer noopener nofollow">[email protected]</a>:project.git
这应该为您提供服务器上可用的引用列表。一旦找到候选者,请尝试使用
克隆它git clone --single-branch --branch refname <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a6c1cfd2e6d4c3d6c988dede88dede88c5c9cb" rel="noreferrer noopener nofollow">[email protected]</a>:project.git
关于git - 如何克隆损坏的 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55658846/