Git从git repository

时间:2016-01-01 10:23:07

标签: git version-control

我有一个存储库,其文件超过100MB。我正在使用BFG an alternative to git-filter-branch 它成功清理了我的文件。但是,当我想将它推送到远程存储库时,它会发出错误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 

1 个答案:

答案 0 :(得分:0)

假设您在分支机构中,您需要进行强制推送。

git push -f origin master

这样做的原因是您已经更改了历史记录,并且您不能只是快进远程存储库以包含这些重大更改。