git: push only specific tags
git tag | grep '^v2\.' | xargs --no-run-if-empty git push <repo>
.git
may not be directory, it may not be there at all. Submodules have there file pointing to root repository. Or you can haveGIT_DIR
set to somewhere else.- When no tags match your criteria, you do not want to do the push.
git push <remote> tag <tag>
In your case it will be
git push origin tag v2.*