On my bitbucket account I have made a public repository named 'https://bitbucket.org/Peixe_verde/compare_qpcr_ddpcr/src/compare_eDNA_in_ddPCR_and_qPCR/'. In the bitbucket website, where I am logged in I can go to 'repository settings' from there I can select 'Access tokens' This allowed me to create an API token. Locally on Ubuntu 24.04 LTS in a terminal I can navigate to the folder with the files I wish to push. I can check that the folder is setup with ' git remote -v', which gives me : "bitbucket https://bitbucket.org/Peixe_verde/compare_qpcr_ddpcr.git (fetch)
bitbucket https://bitbucket.org/Peixe_verde/compare_qpcr_ddpcr.git (push)
origin https://bitbucket.org/Peixe_verde/compare_qpcr_ddpcr.git (fetch)
origin https://bitbucket.org/Peixe_verde/compare_qpcr_ddpcr.git (push)'". I can locally do a "git commit". I then try 'git push bitbucket repositoryname'. And get asked for username and password. I insert my username and the API token but get the '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 ' . I cannot see what is wrong. The repository exists, and I have API token that should work as password. What could be wrong?
Hi @Peixe_verde ,
Welcome to Community…
I understand that you are using an Access token for Authentication during the pull request.
To use access tokens for a repository without an interactive password prompt, you can include the access token in the URL.
Navigate into the newly cloned repository:
cd {repository}/
update the remote URL with the following command:
git remote set-url origin https://x-token-auth:{repository_access_token}@bitbucket.org/{workspace}/{repository}.git
Set the git user for the repository, such as:
git config user.email "{botid}@bots.bitbucket.org"
Please note: To use a Bitbucket Cloud access token for a repository with the Git CLI, create an access token with the following permissions:
* Repository Read (repository)
* Repository Write (repository:write)
More details on the page: https://support.atlassian.com/bitbucket-cloud/docs/using-access-tokens/
Alternatively, you can also use an API token for Authentication as well. More details on the page : https://support.atlassian.com/bitbucket-cloud/docs/using-api-tokens/
Note : API tokens used to access Bitbucket APIs or perform Git commands must have scopes.
I hope this helps.
Best Regards
Shwetha Suvarna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.