There is the LsRemoteCommand
to list the branches of a remote repository. To obtain the command, use either
Git.wrap(repo).lsRemote()
or
Git.lsRemoteRepository()
The statically created LsRemoteCommand
has its limitations. For certain transport protocols, a local repository is necessary to obtain configuration settings. Therefore I usually create an empty temporary local repository with Git.init()
and then use the first approach.
If you want to avoid creating the extra repository, you can test with Transport.open()
if it succeeds without a repository. It throws a NotSupportedException
otherwise.