簡體   English   中英

Git從git倉庫中刪除大文件

[英]Git Remove Large file from git repository

我有一個文件庫超過100MB的存儲庫。 我正在使用BFG 替代git-filter-branch,它成功清除了我的文件。 但是,當我要將其推送到遠程存儲庫時,它給出了一個remote: error: denying non-fast-forward refs/heads/branch-name (you should pull first)錯誤remote: error: denying non-fast-forward refs/heads/branch-name (you should pull first)

下面列出了我遵循的步驟

$ git clone --mirror git://example.com/some-big-repo.git
java -jar bfg.jar --strip-blobs-bigger-than 100M myrepo.git
$ cd myrepo.git
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive

git push之后顯示以下錯誤

Counting objects: 3070, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (961/961), done.
Writing objects: 100% (3070/3070), 47.79 MiB | 307.00 KiB/s, done.
Total 3070 (delta 1644), reused 2834 (delta 1565)
remote: error: denying non-fast-forward refs/heads/baranchName (you should pull first)
remote: error: denying non-fast-forward refs/heads/baranchName (you should pull first)
remote: error: denying non-fast-forward refs/heads/develop (you should pull first)
remote: error: denying non-fast-forward refs/heads/baranchName (you should pull first)
remote: error: denying non-fast-forward refs/heads/baranchName (you should pull first)
remote: error: denying non-fast-forward refs/heads/baranchName (you should pull first)
remote: error: denying non-fast-forward refs/heads/baranchName (you should pull first)
remote: error: denying non-fast-forward refs/heads/tagversion1.2 (you should pull first)
remote: error: denying non-fast-forward refs/heads/tagversion1.3 (you should pull first)
remote: error: denying non-fast-forward refs/heads/tagversion2 (you should pull first)
remote: error: denying non-fast-forward refs/heads/v1.2-fixes (you should pull first)
remote: error: denying non-fast-forward refs/heads/version1 (you should pull first)
To ssh://repo-path
 ! [remote rejected] baranchName1 -> baranchName1 (non-fast-forward)
 ! [remote rejected] baranchName2 -> baranchName2 (non-fast-forward)
 ! [remote rejected] baranchName3 -> baranchName3 (non-fast-forward)
 ! [remote rejected] baranchName4 -> baranchName4 (non-fast-forward)
 ! [remote rejected] baranchName5 -> baranchName5 (non-fast-forward)
 ! [remote rejected] baranchName6 -> baranchName6 (non-fast-forward)
 ! [remote rejected] baranchName1 -> baranchName7 (non-fast-forward)
 ! [remote rejected] tagversion1.2 -> tagversion1.2 (non-fast-forward)
 ! [remote rejected] tagversion1.3 -> tagversion1.3 (non-fast-forward)
 ! [remote rejected] tagversion2 -> tagversion2 (non-fast-forward)
 ! [remote rejected] v1.2-fixes -> v1.2-fixes (non-fast-forward)
 ! [remote rejected] version1 -> version1 (non-fast-forward)
error: failed to push some refs to 

假設您在分支主機中,則需要進行強制推送。

git push -f origin master

這樣做的原因是您更改了歷史記錄,而不能僅僅快進遠程存儲庫以包括這些主要更改。

暫無
暫無

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

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