Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
719 views
in Technique[技术] by (71.8m points)

git - Source Forge repo gives "denying non-fast-forward refs/heads/master" error

I rewrote the tree to my git repository to fix errors in the author name and email address. Now I'm trying to push the fixed tree to my repo on Source Forge. CharlesB told me how to update the config file on the Source Forge servers. My config file looks like this:

[codeguru@shell-24003 bbct]$ cat config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = true
        sharedrepository = 2
[receive]
        denyNonFastforwards = false

Now when I try to force a push, I get the following error:

$ git push -f
Password:
Counting objects: 464, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (148/148), done.
Writing objects: 100% (452/452), 470.65 KiB, done.
Total 452 (delta 268), reused 417 (delta 247)
remote: error: denying non-fast-forward refs/heads/master (you should pull first)
To ssh://[email protected]/p/bbct/code
 ! [remote rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://[email protected]/p/bbct/code'

What's going on here? More importantly, how do I fix it?

Update:

Running git push -f on a public campus computer gives the same error message as above.

Another Update:

I cloned the SF repo to a temporary folder, reset this temporary repo's master branch to the commit just before the first commit with the wrong author and email, then ran git push -f. I get the exact same error message as with my original repo:

$ git push -f
Password:
Total 0 (delta 0), reused 0 (delta 0)
remote: error: denying non-fast-forward refs/heads/master (you should pull first)
To ssh://[email protected]/p/bbct/code
 ! [remote rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://[email protected]/p/bbct/code'

I guess SF really doesn't want me doing a non-fast-forward commit here :-(

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It could be a simple matter of case:

[receive]
        denyNonFastForwards = false

Note the uppercase 'F' for 'Forwards'.
So fix your config file on the Source Forge servers, and your git push -f should succeed, from any workstation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...