Java Jgit克隆特定标签

Java Jgit克隆特定标签,java,clone,jgit,Java,Clone,Jgit,我正在使用jgit库克隆代码。我可以做到这一点,但我想知道我是否可以克隆特定的标签。我发现我可以通过 "Git.cloneRepository().setURI(remotePath).setBranch("BranchName").setDirectory(new File(localPath)).call();" 但我需要克隆特定的标签。提前感谢您的帮助或建议。。。。。我在下面给出了我正在使用的代码 public String checkOutCode(String remotePath)

我正在使用jgit库克隆代码。我可以做到这一点,但我想知道我是否可以克隆特定的标签。我发现我可以通过

"Git.cloneRepository().setURI(remotePath).setBranch("BranchName").setDirectory(new File(localPath)).call();"
但我需要克隆特定的标签。提前感谢您的帮助或建议。。。。。我在下面给出了我正在使用的代码

public String checkOutCode(String remotePath) throws IOException {
        String localPath = Constants.CODEBASE;;
        Repository localRepo;
        Git git;
        LOGGER.info("Code Checkout Started");

        localRepo = new FileRepository(localPath + "/.git");
        CustomConfigSessionFactory cuFactory = new CustomConfigSessionFactory();

        SshSessionFactory.setInstance(cuFactory);        
        git = Git.cloneRepository().setURI(remotePath).setDirectory(new File(localPath)).call();

        LOGGER.info("Code Checked out at " + localRepo + " " + git.toString());

        return localPath;
    }

CloneCommand
获取所有标记。您是否检查了所需的标记是否存在于克隆的存储库中?是的,所需的标记存在于我克隆的存储库中。我想我会将它切换到所需的标签…然后这个问题可以关闭或删除,对吗?是的,这个问题可以关闭。非常感谢。