javadocs to explain what this is attempting to do? Looks like it tries to find all the references at the given URI that resemble the "productVersion"? This assumes that the tag format doesn't contain a prefix like "v1.0.0" which is pretty common.

Also, you can specify a "--tags" or "-t" argument to limit to only tags, eliminating the needs to pre-pend refs/tags/. (see https://www.kernel.org/pub/software/scm/git/docs/git-ls-remote.html)