I have my own GIT server, in which I did a 'bare clone' of a public repo. Let's call PUB the public repo, and LOC the bare clone on my own server. I use LOC as remote for developing, creating my own branches that are not present in PUB. Then I push my branches to LOC.
I want to fetch any new content from PUB to LOC but I do not want any of my own branches to be pushed from LOC to PUB.
I can do none operation on PUB since it is out of my control. I can do any operation on LOC instead.
For the purposes I described I have a script, run every night, that executes:
git --git-dir ${LOC_PATH} remote update --prune
If I clone PUB to LOC using
git clone --mirror <remote_repo>
then at the script execution my own branches are erased from LOC.
If I clone PUB to LOC using
git clone --bare <remote_repo>
then the script seems to fetch successfully PUB to LOC (that's what the command output suggests); but observing LOC content with a browser or fetching LOC to my PC I don't see in the log any new commit that I know to be present in PUB.
Reading the answers on other stackoverflow questions, it seems that the right command is:
git --git-dir ${LOC_PATH} fetch --all
but at present time I stick to git ... remote update ...
since it should do an implicit fetch
operation.
Is there any solution for automatically keep up to date this quirky form of mirroring?
I looked at:
- Mirror git repo into new branch
- How do you update a bare repo from a remote source using git
- How to keep all branches and tags in sync in a fork or mirror repo?
- How do I update my bare repo?
and some other sites found on internet. Obviously I found no viable solution.