[英]BFG Repo-Cleaner states my github repo is not a valid Git repository
這是Stackoverflow 上一個問題的后續問題。
我試圖從本地 git 歷史記錄中刪除大文件,但此問題中建議的工具 (BFG Repo-Cleaner) 指出我的私有 GitHub 存儲庫不是有效的 git 存儲庫。
我使用的命令是:
java -jar bfg-1.12.12.jar --strip-blobs-bigger-than 99M https://github.com/name/repo.git
最終導致:
Aborting : https://github.com/name/repo.git is not a valid Git repository.
我找不到解決辦法。 該工具是否與私有或 https GitHub 存儲庫不兼容? 我將如何使用替代工具git-filter-branch
從本地 git 歷史記錄中刪除所有大於 99MB 的文件?
該項目大約有 6MB 大,到目前為止只有大約 50 次提交,沒有其他人在處理它。
指向本地副本,而不是遠程副本。
您已將 GitHub URL 提供給該工具,但其網站上的使用部分說您應該從存儲庫的本地副本中工作:
用法
首先使用
--mirror
標志克隆你的 repo 的新副本:$ git clone --mirror git://example.com/some-big-repo.git
這是一個裸倉庫,這意味着您的普通文件將不可見,但它是您倉庫的 Git 數據庫的完整副本,此時您應該對其進行備份以確保您不會丟失任何內容.
現在您可以運行 BFG 來清理您的存儲庫:
$ java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git
該頁面上還有很多其他好的內容; 我建議您在重試之前閱讀整篇文章。
我已經使用以下命令修復了這個問題:
第 1 步
cd some-big-repo.git
第 2 步
java -jar path/bfg.jar --strip-blobs-bigger-than 100M
如果您在 repo 目錄中,則無需明確提及 repo 名稱,它會自動檢測 repo 並完成其工作。
您應該記住,使用 git,您對歷史記錄所做的一切都必須在本地完成。 然后,在您滿意后,通過推送到遠程存儲庫來發布。
因此,在這里您必須提供通往本地存儲庫的路徑...
非常簡單,只需在命令行中執行以下操作:
#Change directory to the root of your git repo
cd C:\Projects\MyRepositoryFolder
#Drag the bfg.jar file (or what ever the .jar file name you have) into the repo folder you changed directory to (above). Then once done run
java -jar bfg.jar -b 100M
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.