git - 如何克隆损坏的 git 存储库

标签 git

我尝试克隆存储库时遇到的错误:

$ 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/

相关文章:

git - "git check-ignore *"和 "git ls-files --other --ignored --exclude-standard"有什么区别?

git - 网络启动 SSHD HELPMSG 3534

ruby-on-rails - 无法安装 charlock_holmes-0.6.9.4

php - 从本地主机移动到远程后,Wordpress 管理 URL 出现错误

git - 防止 Jenkins 在构建运行时轮询 SCM (Git)

Github 样式在命令行上拆分差异

git log 缩写格式长度

git - 将项目从 PVCS 转移到 Git

git - Github Fork 的创建时间

git - 将 VSTS Git Repo merge 到另一个 VSTS Git Repo