javaauthenticationbitbucketgit-clonejgit

how to use bitbucket access token with JGit instead of user / pass


I'm googling without any luck about how to use bitbucket access token instead of user / password with JGit client library.

The code below is about cloning a repo using a bitbucket user / pass.. How should I change this code to use bitbucket access token?

            Git.cloneRepository()
                    .setURI("https://bitbucket.myserver.net/scm/d1app/mobile-testing-scenarios.git")
                    .setDirectory(new File("/home/darena/repo_download_path"))
                    .setCredentialsProvider(new UsernamePasswordCredentialsProvider("bitbucketUser", "bitbucketPass"))
                    .call();

Solution

  • The documentation says to use the token as a password.