![](/img/trans.png)
[英]How to remove/delete a large file from commit history in the Git repository?
[英]How to remove file from git repository but only up to a certain point in history?
我知道如何使用filter-branch將文件完全從存儲庫歷史記錄中刪除。 發生的事情是我之前提交的文件中包含一些敏感信息,但是我已將其刪除,因此我希望繼續進行安全提交。
我可以做嗎? 還是我必須做一些克隆技巧?
我認為BFG Repo-Cleaner正是您所需要的。
您可以使用它來替換或刪除整個存儲庫歷史記錄中包含在工作樹中的敏感信息(例如密碼)。 這是他們的文檔中的一個示例:
bfg --replace-text passwords.txt /path/to/repository
然后passwords.txt
文件將包含一系列字符串,以匹配它們應替換為的值。 例如:
password # Replaces the string 'password' with '***REMOVED***' (default)
password==>DELETED # Replaces the string 'password' with 'DELETED'
password==> # Replaces the string 'password' with an empty string
regex:password.+==> # Replaces using a regular expression with an empty string
與git-filter-branch
,這是一個重寫歷史記錄操作,因此適用通常的免責聲明。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.