I'm using Jenkins and currently we use user/password to access our git repos on Bitbucket cloud.
But Bitbucket is replacing user/passwords with API tokens. How can I configure Jenkins to use them?
Hi Ali,
welcome to the Atlassian Community!
To configure Jenkins for Bitbucket Cloud, you should replace your standard user password with either an App Password or an SSH Key. Bitbucket Cloud uses App Passwords instead of traditional "API Tokens" for HTTPS authentication.
If you prefer using HTTPS, you must generate a scoped App Password to serve as your credential.
Repository: Read permissions (and Write if your pipeline needs to push). Official Documentation: Create an App password
Using SSH keys is the most secure method for Jenkins automation as it avoids the use of password-like tokens.
git@bitbucket.org:workspace/repo.git). Official Documentation: Set up an SSH key
| Feature | App Password (HTTPS) | SSH Key (Recommended) |
|---|---|---|
| Credential Type | Username & Password | SSH Private Key |
| Security | Scoped permissions | No password transmission |
I hope this helps you get your Jenkins pipeline updated! Let me know if you run into any issues.
Greetings,
Alex
This does not answer the question, which specifically asks for API Token usage.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hristo,
you’re absolutely right. Thanks for pointing it out.
In my previous reply I was mainly aiming at the “best practice” angle (using an SSH key for non-interactive automation), but I did indeed neglect the actual API token part of Ali’s question.
For completeness: Bitbucket Cloud supports API tokens, and Jenkins can use them for Git-over-HTTPS by storing the token as the secret in a standard username/password credential (token as the “password”, and either your Bitbucket username or x-bitbucket-api-token-auth as the username).
Further documentation:
Greetings,
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.