Is it possible somehow to set up a git repository that works as a usual --mirror for pulling into it, but without forcing when pushing from it to another repo?
You can just add --no-force to disable the forcing behavior like so:
git push --mirror --no-force
This will disable non-fast-forward updates (tested with git 1.8.0.2).
I'd like to do a git push --mirror that will fail if a non-fast forward update is required.
A git push --mirror should fail if the upstream repo has its config set to receive.denyNonFastForwards true
:
git config
man page:
receive.denyNonFastForwards
If set to
true
,git-receive-pack
will deny a ref update which is not a fast-forward.
Use this to prevent such an update via a push, even if that push is forced.
This configuration variable is set when initializing a shared repository.
That means you wouldn"t have to "reproduce what --mirror
" does: you could simply use it, and still have that push fail if any non-fastforward merge is involved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With