There appears to be a long-standing bug in git ls-remote
:
$ git ls-remote origin
676699a0e0cdfd97521f3524c763222f1c30a094 HEAD
222c4dd303570d096f0346c3cd1dff6ea2c84f83 refs/heads/branch
676699a0e0cdfd97521f3524c763222f1c30a094 refs/heads/master
d41117433d7b4431a188c0eddec878646bf399c3 refs/tags/tag-foo
$ git ls-remote origin --tags
$ git ls-remote --tags origin
d41117433d7b4431a188c0eddec878646bf399c3 refs/tags/tag-foo
(I found a report about this bug going back to git 1.5.4.) So, it works but only if you use --tags
first, then name the remote you wish to contact.
Since ls-remote
will only do one remote at a time, you will have to collect up a list of all remotes, then iterate.