@ompugao_ blog

hello this wonderful world

Can't git push --force

Today, I cannot git push –force.(Please don’t say I should not do the command…)

% git push --force origin master
Counting objects: 11, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (8/8), 931 bytes, done.
Total 8 (delta 6), reused 4 (delta 2)
error: denying non-fast forward refs/heads/master (you should pull first)
To ******/*******
 ! [remote rejected] master -> master (non-fast forward)
 error: failed to push some refs to '****************'



ssh repos_machine
cd path/to/git/bare/repos
cat config
        repositoryformatversion = 0
        filemode = true
        bare = true
        sharedrepository = 1
        denyNonFastforwards = true    <<<===!!!!!!!

By changing the receive.denyNonFastforwards option to ‘false’, you can git push –force.

I’ve never seen this option until today.