簡體   English   中英

克隆時網絡驅動器上的 Git 存儲庫都顯示相同的錯誤:“packfile 與索引不匹配”

[英]Git repositories on network drive all showing same error when cloned: "packfile does not match index"

我一直試圖解決這個問題幾個小時,我的運氣為 0。 提前道歉,我對 Git 還是個新手。

我在網絡驅動器(R:驅動器)上有大量 Git 存儲庫。 所有這些存儲庫都是另一個存儲庫的克隆,每個存儲庫都進行了不同的更改。

對於我的工作,我經常需要將 10 個以上的這些存儲庫克隆到我的本地機器(C:驅動器),所以我想我會制作一個批處理腳本來為我自動化這個過程。

當我運行我的批處理腳本(基本上只有 10+ git clone R:\\INSERT_REPO_HERE C:\\INSERT_DIRECTORY_HERE語句)時,這個過程需要幾個小時,但這很正常,因為我與 R: 驅動器的連接很差。

問題:

我正在尋找加快克隆過程的方法,並找到了執行以下操作的建議:

git config --global pack.windowMemory "100m"
git config --global pack.SizeLimit "100m" 
git config --global pack.threads "1"
git config --global pack.window "0"
git config --global core.compression 0
git config --global core.bigfilethreshold 200K

所以,我在 R: 和 C: 驅動器上運行了這些命令。

現在,每當我從 R: 驅動器將任何repo 克隆到我的 C: 驅動器時,我都會收到以下錯誤:

Cloning into 'C:\Users\games\Documents\BitBucket\Adapt topics\BU11\BU11.3\src\course\en'...
done.
error: packfile C:/Users/games/Documents/BitBucket/Adapt topics/BU11/BU11.3/src/course/en/.git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile C:/Users/games/Documents/BitBucket/Adapt topics/BU11/BU11.3/src/course/en/.git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: unable to read sha1 file of project/bower.json (15bb293aca56d25d07f9372c81d6d008b41f93cc)


error: packfile C:/Users/games/Documents/BitBucket/Adapt topics/BU11/BU11.3/src/course/en/.git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile C:/Users/games/Documents/BitBucket/Adapt topics/BU11/BU11.3/src/course/en/.git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: unable to read sha1 file of project/js/project.js (02dbe8ec5a71541ce175fada7e0d405359124968)


fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

我試過--unset設置我設置的全局配置,但它沒有解決任何問題。 據我所知,R: 驅動器上的 repos 仍然包含我所有的文件,所以我沒有丟失任何數據; 但我似乎無法找到解決此問題的方法,並且在 R: 驅動器上重新創建每個存儲庫也會花費我很長時間。

此外,運行git fsck --full會給出這個結果,無論我在哪個存儲庫上執行它:

Checking object directories: 100% (256/256), done.
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack cannot be accessed
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
Checking connectivity: 369, done.
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
broken link from    tree fc7405e6041f547e5845cead57f06a38ed4b814f
              to    blob db3d21c232d266d476e028af6fe640b5447dba14

我什至不完全確定什么是“打包文件”。 請,任何幫助將不勝感激!

編輯:我不知道這是否有幫助,但查看 R: 驅動器中每個存儲庫的.git/objects/pack文件夾顯示 .pack 文件最后一次修改是在我運行git config命令的同一天:

包上次修改

切勿將 Git 存儲庫存儲在聯網或雲同步的驅動器上。

什么,“從不”? 1

是的,真的,從來沒有 為什么不? 因為像你看到的那樣的問題發生。 只是不要這樣做。


1強制性鏈接

雖然不是我原來帖子的答案,但我找到了一種適合我的具體情況的解決方法。 基本上,我只是重新創建了每個存儲庫。

我進入每個存儲庫並刪除“.git”文件,然后運行

git init
git add .
git commit -m 'PackFix'

這確實意味着我現在已經丟失了這些存儲庫的所有 Git 提交歷史記錄,但幸運的是(對於我的特定情況),這不是一個大問題。

對於將來讀到這篇文章的任何人,我想說這個帖子更像是一個關於在網絡驅動器上運行--global命令的警告(特別是如果你不完全理解他們會做什么的話)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM