I added ssh keys into https://bitbucket.org/account/settings/ssh-keys/, also I added Access key to project and repository. I did it several times with different types of encoding, but I get this error all the time
The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Hi @Tabs Book and welcome to the community!
If we're talking about one computer, then it is not necessary to add so many keys.
If this is your own computer and you want to have read-write access to the repo, then a key added to https://bitbucket.org/account/settings/ssh-keys/ is the way to go. Access keys (either project or repository) provide read-only access, which means you won't be able to push with these keys. Access keys are usually used in CI servers, where you normally only need to pull a repo (and not push).
Now, how to make this work?
1. If you have multiple SSH keys in the ~/.ssh folder on this computer, then your SSH client may not be picking the SSH key you want.
If there is a file named config in your ~/.ssh folder, add the following content to it:
Host bitbucket.org
AddKeysToAgent yes
IdentityFile ~/.ssh/{ssh-key-name}
where {ssh-key-name} replace with the name of the private SSH key file, whose public key you have uploaded to Bitbucket. If we're talking about your own computer and you want read-write access, ensure it's the private key whose public key you have added to https://bitbucket.org/account/settings/ssh-keys/.
This config will ensure that your SSH client always uses this key during clone, pull, push from a Bitbucket repo.
If there is no file named config in your ~/.ssh folder, create it and add the content I shared above.
2. Ensure that the remote URL in your repo is an SSH URL.
You can run the following command from the directory of the clone to find its remote URL:
git remote -v
If the URL in the output has the following format:
git@bitbucket.org:workspace-id/repo-slug.git
then the remote repo is using an SSH URL.
Please feel free to let me know how it goes and if you have any questions!
Kind regards,
Theodora
Hi,
That error usually points to an authentication issue or incorrect repository URL. Since you've already added the SSH key and tried different encodings, here are a few things to double-check:
Confirm the repo exists and you're using the correct SSH URL
Make sure you're cloning or pulling using the correct SSH format:git@bitbucket.org:workspaceID/repo-name.git
You can find the correct SSH URL on the repository page under "Clone".
Check if the SSH key is added to the correct account
If you're using a personal SSH key, it should be added to your Bitbucket personal account (under SSH keys).
Access keys at the repo or project level are usually read-only and meant for automation or scripts, not interactive development.
Check repository access
If you're using your personal SSH key, ensure that your Bitbucket user has access to the repository. Being part of the workspace doesn’t guarantee access to all repositories.
Test your SSH connection
Run:ssh -T git@bitbucket.org
If it responds with a greeting like "logged in as your-username", the key is working. If not, it could be an SSH agent issue or a missing key.
Check SSH agent
Make sure the correct key is loaded into your SSH agent:ssh-add -l
(lists loaded keys)
If your key isn’t listed, add it with:ssh-add ~/.ssh/your_private_key
Let me know if you're still stuck after checking these—happy to help further.
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.