Search code examples
jenkinsbitbucketcredentials

Bitbucket app password enforcement: jenkins credentials broken


A previously-working jenkins bitbucket user credential has been broken by Atlassian Bitbucket's new enforcement of using app passwords only, even when the new app password is updated in the credential for the same user/credential. This error is displayed in jenkins:

> Failed to connect to repository : Command "git ls-remote -h --
> https://bitbucket.org/<project>/<repo>.git HEAD" returned status code
> 128: stdout: stderr: remote: Bitbucket Cloud recently stopped
> supporting account passwords for Git authentication. remote: See our
> community post for more details:
> https://atlassian.community/t5/x/x/ba-p/1948231 remote: App passwords
> are recommended for most use cases and can be created in your Personal
> settings: remote:
> https://bitbucket.org/account/settings/app-passwords/ fatal:
> Authentication failed for
> 'https://bitbucket.org/<project>/<repo>.git/'

I also tried deleting and recreating the credential with the new app password and this error still happens. How to get the credential working again?


Solution

  • The user in the credential previously was the email address for the Bitbucket account. The user needed to be changed to the actual username for the account as found in BitBucket web interface > User Avatar > Personal Settings > Account Settings > Bitbucket profile settings section > Username.

    enter image description here