A legacy Git repo hosting provider with the worst CI/CD of the major 4 Git hosting providers.
https://bitbucket.org/account/settings/ssh-keys/
Deprecated in favour of API Tokens.
https://bitbucket.org/account/settings/app-passwords/
Create an API token here:
https://id.atlassian.com/manage-profile/security/api-tokens
and then copy, save it and export it:
export BITBUCKET_TOKEN=...Cloning with HTTPS then becomes:
git clone "https://$BITBUCKET_TOKEN@bitbucket.org/$ORG/$REPO.git"or better using a credential helper...
Taken from my .gitconfig:
[credential "https://bitbucket.org"]
helper = "!f() { sleep 1; echo \"password=${BITBUCKET_TOKEN}\"; }; f"git clone "https://bitbucket.org/$ORG/$REPO.git"If you get a 401 or 403 authentication or authorization error, you can check Git debug output by setting:
export GIT_CURL_VERBOSE=1You may need to put your username in the Bitbucket URL if using App Passwords in order to get past the 403 error:
https://harisekhon@bitbucket.org/...in order to get this to work as the behaviour even when trying the credential helper with the username seems to not work:
[credential "https://bitbucket.org"]
helper = "!f() { sleep 1; echo \"username=${BITBUCKET_USER}\"; echo \"password=${BITBUCKET_TOKEN}\"; }; f"