git clone ssh://example.com/project.git # 出現下述錯誤
error: git upload-pack: git-pack-objects died with error.
remote: fatal: object 161824656702683f2b9c06a3511143f56da8ee0a is corrupted
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: index-pack failed
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
git clone -v ssh://example.com/project.git
Initialized empty Git repository in /home/user/project/.git/
user@example.com's password:
Server supports multi_ack_detailed
Server supports side-band-64k
Server supports ofs-delta
want 1dd602b6095d36e8c50bcc1335f7b6b2320ab9cd (refs/heads/master)
done
remote: fatal: object f3c8013acb933dc392e3ac2905901671141fbae1 is corrupted
error: git upload-pack: git-pack-objects died with error.
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: index-pack failed
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
問題
發現 Server 上的 project.git 裡面的 objects 的 hash 檔案權限有問題(變 600), 所以無法讀取.
發生原因應該是用太多種方式 commit, push 吧~ (http, ssh push)
解法
- ssh git-server
- cd project.git/objects
- find . -type f -exec sudo chmod 644 {} \; # 把 object 裡面一律改成 644.
測試
git clone -v ssh://example.com/project.git
Initialized empty Git repository in /home/user/project/.git/
Server supports multi_ack_detailed
Server supports side-band-64k
Server supports ofs-delta
want 1dd602b6095d36e8c50bcc1335f7b6b2320ab9cd (refs/heads/master)
done
remote: Counting objects: 165, done.
remote: Compressing objects: 100% (151/151), done.
remote: Total 165 (delta 64), reused 0 (delta 0)
Receiving objects: 100% (165/165), 72.92 KiB, done.
Resolving deltas: 100% (64/64), done.