Git mirror without pushing

Is it possible to somehow create a git repository that works like a normal --mirror to pull into it, but without coercion when moving from it to another repo?

+4
source share
3 answers

I would like to make a git push -mirror that will fail if an immediate update is required forward.

A git push -mirror should fail if the upstream repository is set to receive.denyNonFastForwards true :

git config man page :

 receive.denyNonFastForwards 

If set to true , git-receive-pack will reject the ref update, which is not a fast forward.
Use this to prevent such an update via push , even if this push is forced .
This configuration variable is set when the shared repository is initialized.

This means you donโ€™t need to โ€œreproduce what --mirror โ€: you could just use it and still have this crash on failure if any immediate merge is involved.

+3
source

You can simply add --no-force to disable the enforcement behavior as follows:

 git push --mirror --no-force 

This will disable updates without forwarding (verified with git 1.8.0.2).

+3
source

Is there a way to reproduce what -mirror does with other options?

Some of what mirror can be done with a few taps:

 git push <remote> --all # push all branches git push <remote> --tags # push all tags git push <remote> refs/remotes/* #push the remote refs 
0
source

All Articles