I currently have several repositories with BitBucket and I'm trying to switch from using App Passwords to the new API Token. I already have the repositories cloned to my desktop and have been working on them for years.
I'm just trying to make the transition but I keep getting authorization failed notices.
I've tried both of the following from the command line in MacOS Terminal when I'm in the directory:
`git remote set-url origin https://{my_username}:{api_token}@bitbucket.org/{workspace}/{repo_name}.git`
and
`git remote set-url origin https://{my_username}@bitbucket.org/{workspace}/{repo_name}.git`
(i obviously used my actual username, worskpace and repo_name in the curly brackets above)
Both of which give me the following error after I try to push a commit to bitbucket:
`remote: You may not have access to this repository or it no longer exists in this workspace. If you think this repository exists and you have access, make sure you are authenticated.
fatal: Authentication failed for 'https://bitbucket.org/{workspace}/{repo_name}.git/'`
What do I need to do in order to get this to work? The API token is just a normal API token without any scopes. I would think this means I can use it for any of my repositories using any command (like a push).
The API token requires scopes, you may not use it without scopes to authenticate with GIT.
To start using API tokens with Bitbucket Cloud - you'll need to create the API token and specify the scope - this is mentioned in our deprecation documentation:
Click the gear cog icon, select Atlassian Account settings > Security tab > Create and manage API Tokens
Click Create API token with scopes and select Bitbucket Cloud
If you want to be able to clone/push/pull to the repository - you'll need to tick both read:repository:bitbucket and write:repository:bitbucket - clone only would just be read:repository:bitbucket.
More information on scopes can be found in our API scopes documentation.
Perform the clone using the API token by executing either of the commands below (if using the first command - you can find your username by clicking the gear cog icon and selecting Personal Bitbucket Settings - it's visible under the Bitbucket Profile Settings heading):
Please perform the above and let me know how this goes. If you are still encountering issues, I will assist you further.
Cheers!
- Ben (Bitbucket Cloud Support)
I am also facing the same issue. I could see the API calls to bitbucket as its showing last accessed as latest but getting authentication error. I have tried creating the API token with scopes as mentioned in the documentation.
Create an API token | Bitbucket Cloud | Atlassian Support
Apparently none of the command didn't worked out.
Using API tokens | Bitbucket Cloud | Atlassian Support
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.