Configure username and password
This page provides information regarding setting up your Jenkins instance to use username and password credentials for communication with your Bitbucket repository.
Create an app password in Bitbucket Cloud
Log in to Bitbucket Cloud.
Click Settings () in the top-right corner of the page and select Personal Settings. Your Personal Settings page opens.
Under Access Management in the left sidebar, select App passwords.
Click Create app password.
In the Label field, enter a name. We recommend including information about where the password is used.
Select the permissions the App password needs. You should have read/write or admin access.
Click Create. The New app password dialog opens.
Copy the generated password. You will not be able to view the password again once you close the dialog. This is the password you will use when configuring Jenkins.
Jenkins configuration
There are different methods for accessing the Jenkins Credentials Provider page. This section describes how to add a new username and password to Jenkins through a Jenkins job and through global credentials.
Credentials Provider through a Jenkins job
Log into your Jenkins instance.
Add or select the job you want to associate with your Bitbucket repository.
Once you are in the job, click Configure from the left menu.
When the Configuration page opens, select the Source Code Management tab.
Select the Git option.
In the Repository URL field, enter the URL for the Bitbucket repository Jenkins will integrate with.
Click Add to open the Jenkins Credentials Provider dialog.
Select Username with password from the Kind pulldown list.
Provide the following information:
Scope - leave this at the default Global credentials setting.
Username - the Bitbucket username associated with the repository set in the Repository URL field.
Password - the app password for the Bitbucket username associated with the repository.
Treat username as secret (optional)- select to mask the username in the build log.
ID (optional) - set this to help better identify this specific configuration. If left blank, Jenkins generates an ID.
Description (optional) - add a description to help differentiate between credentials.Click Add.
In the Credentials field, select the credentials you just created from the list.
Click Save.
Credentials Provider through global credentials
Log in to your Jenkins instance with your administrator credentials.
From the Jenkins dashboard, click on Manage Jenkins in the left sidebar.
Scroll down to the Security section and click Credentials.
Click (global) under the Domain column from an existing credentials entry or under the Domains column for an entry in the Stores scoped to Jenkins section to proceed to the Global credentials (unrestricted) page.
Click Add Credentials.
In the Kind dropdown, select Username with password.
Provide the following information:
Scope - leave this at the default Global credentials setting.
Username - the Bitbucket username associated with the repository set in the Repository URL field.
Password - the app password for the Bitbucket username associated with the repository.
Treat username as secret (optional)- select to mask the username in the build log.
ID (optional) - set this to help better identify this specific configuration. If left blank, Jenkins generates an ID.
Description (optional) - add a description to help differentiate between credentials.Click Create.
When configuring a Jenkins job that requires Bitbucket Cloud access, select the credentials from the Credentials dropdown menu.
If you see a Failure to connect to repository error message, confirm the entry in the Repository URL field is correct and that the username and app password provided here are the same as the credentials used by the user in Bitbucket.