git 镜像存储库在 git show 命令上给出坏对象错误

问题描述 投票:0回答:0

我克隆了一个存储库两次,一次使用正常模式,一次使用 --mirror 标志:

$ git clone https://gitlab.com/abc.git
$ cp abc.git abc_normal.git
$ rm -rf abc.git

$ git clone --mirror https://gitlab.com/abc.git
$ cp abc.git abc_mirror.git

为什么我在普通仓库的镜像中只能看到一些文件,而在普通仓库中可以看到所有文件?

abc_normal.git $ git rev-parse ${commit}:${path}
${file_hash)

abc_normal.git $ git show ${file_hash}
<file content>

abc_mirror.git $ git show ${file_hash}
fatal: bad object ${file_hash}

我能够在镜像和普通 repo 中使用上面的相同命令看到一些文件。

我以为我能够看到镜像仓库和普通仓库中的所有提交和文件哈希,但事实似乎并非如此。感谢您的任何见解!

git hash show mirror
© www.soinside.com 2019 - 2024. All rights reserved.