代码之家  ›  专栏  ›  技术社区  ›  Vic

如何克隆损坏的git repo

git
  •  1
  • Vic  · 技术社区  · 7 年前

    $ git clone git@repo.xx.xx.com: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
    

    有办法解决这个问题吗?

    0 回复  |  直到 7 年前
        1
  •  2
  •   Chris    7 年前

    如果没有对服务器的管理访问权或者没有一个干净的副本,您就几乎无能为力。但是,由于您认为损坏会影响最近的一些提交,因此可以尝试克隆另一个分支,看看是否有效。

    首先,让我们看看可以克隆什么:

    git ls-remote git@repo.xx.xx.com:project.git
    

    这将为您提供服务器上可用的引用列表。一旦你找到一个候选人,试着用

    git clone --single-branch --branch refname git@repo.xx.xx.com:project.git