Keeping tags in target repository during git mirror
We're using git's mirror functionality to mirror an OSS repository into our own git mirror on github. We then tag the sha revisions we deploy in our private mirror so that we can correlate the source to the release. Unfortunately, when the mirror sync runs, it removes the tags in the target mirror b/c they don't exist in the source mirror. Is there any way to mirror and retain the tags on the target repo?
Here's how we're syncing in our sync script.
git clone --mirror https://github.com/usergrid/usergrid.git usergrid_mirror cd usergrid_mirror git remote set-url --push origin https://github.com/mycompany/usergrid.git git push --mirror
When I execute the "push --mirror" my tags in the mycompany/usergrid.git get deleted.
As in "How to undo “git push --mirror”?", you could look in the reflog and see if you can restore the tags that way.
But a more sensible solution going foward would be to:
- use git push --mirror only for the initialization
- don't make any commits on the branches common with the OSS repo, only on new private branches
- update your mirror with a git push --all everytime you want to update your mirror.