try
{
git = Git.open( fileSet.getBasedir() );
CredentialsProvider credentials = JGitUtils.getCredentials( repo );
LsRemoteCommand lsCommand =
git.lsRemote().setRemote( repo.getPushUrl() ).setCredentialsProvider( credentials );
Map<String, String> tag = new HashMap<String, String>();
Collection<Ref> allTags = lsCommand.setHeads( false ).setTags( true ).call();
for ( Ref ref : allTags )
{
tag.put( Repository.shortenRefName( ref.getName() ), ref.getObjectId().name() );
}
Map<String, String> heads = new HashMap<String, String>();
Collection<Ref> allHeads = lsCommand.setHeads( true ).setTags( false ).call();
for ( Ref ref : allHeads )
{
heads.put( Repository.shortenRefName( ref.getName() ), ref.getObjectId().name() );
}