problem with 'git push --force' in mirror mode

1,418 views
Skip to first unread message

Dennis.Yxun

unread,
Jun 23, 2012, 3:23:48 PM6/23/12
to gito...@googlegroups.com

i'm using gitolite version two,and when setup with mirror mode,found the slave server fail to receive update commits when i using the '--force' push commands to the master server,is this made intentional?or any way i can fix?thanks

Sitaram Chamarty

unread,
Jun 23, 2012, 8:00:48 PM6/23/12
to Dennis.Yxun, gito...@googlegroups.com
It's not intentional. As far as I know it should work. I have a very
large mirrored setup (7 cities, 20+ servers, a few dozen repos, ...)
at an internal client and they would have complained long ago if it
hadn't worked.

--
Sitaram

Dennis.Yxun

unread,
Jun 24, 2012, 10:44:08 PM6/24/12
to Sitaram Chamarty, gito...@googlegroups.com
hi sitaram:
sorry for late reply due to vacation.
I setup a new server, did a test once again, it actually fail here.
so, before I'm investigating more, could you kindly give me any hints?

And let me make my case more clear, operations as follow
1) setup mirror mode, say two git servers, MasterA, SlaveB
2) clone from MasterA, made one commit: git commit -asm "one message"
3) git push origin HEAD:refs/heads/master (push to MasterA)
4) verify difference of the branch "master" from MasterA and SlaveB,
should be the same
let mean the mirror operation is successfully made
5) git commit -as --amend "one message, but amend"
6) git push --force origin HEAD:refs/heads/master (push to MasterA, again)
this actually remove previous commit, and override with another one
7) try to fetch MasterA, SlaveB, and verify the difference, SlaveB's
master branch still stall at previous commit, not updated
And wonder anyone else encountered this problem? or did I miss something?

Dennis

Dennis.Yxun

unread,
Jun 24, 2012, 10:52:19 PM6/24/12
to Sitaram Chamarty, gito...@googlegroups.com
Hi sitaram:
Oh, here is more info from gitolite logs
Note this first line, actually I added the "--force" parameter, but
that doesn't solve my problem.


32218: ==== WARNING: RC=1 from git push --force --mirror gitsrv2:testing ====
32218:2012-06-25.10:28:33 ===> sabayon
32218:
480:2012-06-25.10:29:41 testing ===>
480: sabayon <=== (testing) ==== android3
480: remote: error: denying ref deletion for refs/heads/mybox
480: remote: error: denying non-fast-forward refs/heads/master (you
should pull first)
480: To sabayon:testing
480: ! [remote rejected] mybox (deletion prohibited)
480: ! [remote rejected] master -> master (non-fast-forward)
480: error: failed to push some refs to 'sabayon:testing'

Sitaram Chamarty

unread,
Jun 24, 2012, 11:00:50 PM6/24/12
to Dennis.Yxun, gito...@googlegroups.com
On Mon, Jun 25, 2012 at 8:22 AM, Dennis.Yxun <denni...@gmail.com> wrote:
> Hi sitaram:
>  Oh, here is more info from gitolite logs
>  Note this first line, actually I added the "--force" parameter, but

--mirror implies --force as far as your use case is concerned.

> 480:    sabayon <=== (testing) ==== android3
> 480:    remote: error: denying ref deletion for refs/heads/mybox
> 480:    remote: error: denying non-fast-forward refs/heads/master (you
> should pull first)
> 480:    To sabayon:testing
> 480:     ! [remote rejected] mybox (deletion prohibited)
> 480:     ! [remote rejected] master -> master (non-fast-forward)
> 480:    error: failed to push some refs to 'sabayon:testing'

those errors are not from gitolite. You probably have
receive.denyNonFastForwards and other such configs set on your mirror
server, so git itself is rejecting them.

Dennis.Yxun

unread,
Jun 24, 2012, 11:14:19 PM6/24/12
to Sitaram Chamarty, gito...@googlegroups.com
Hi sitaram:
You're right, that's the problem!
I set receive.denyNonFastForwards in the slave server intentionally
due to some security concern (to prevent malicious or careless operation)
problem solved, thanks!

Sitaram Chamarty

unread,
Jun 24, 2012, 11:58:21 PM6/24/12
to Dennis.Yxun, gito...@googlegroups.com
On Mon, Jun 25, 2012 at 8:44 AM, Dennis.Yxun <denni...@gmail.com> wrote:
> Hi sitaram:
>  You're right, that's the problem!
> I set receive.denyNonFastForwards in the slave server intentionally
> due to some security concern (to prevent malicious or careless operation)

you should have more faith in gitolite...
Reply all
Reply to author
Forward
0 new messages