Diego Arena
Diego Arena

Reputation: 136

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();

Upvotes: 4

Views: 1802

Answers (2)

If you are refering to Bitbucket personal access tokens, then the Csaba Skrabak's answer is correct.

If you are refering to repository/project/workspace access tokens, then I will say your question is similar to this one. I recommend you reading my answer.

Upvotes: 0

Csaba Skrabak
Csaba Skrabak

Reputation: 56

The documentation says to use the token as a password.

Upvotes: 3

Related Questions