Hi - hopefully someone can help here
Im having issues using git push (git pull works fine) - i have a SSH key set up, but still get the following error :
Unauthorized
fatal: Could not read from remote repository
Please make sure you have the correct access rights and the repository exists
I have used git + bitbucket for quite some time, but have recently got a new laptop (macbook air m3) so may have done a step wrong during setup (previous computer worked fine with pull and push)
any help would be greatly appreciated
Hi Ian and welcome to the community!
There are two things to check here:
1. Did you add the public SSH key to the keys of your account here https://bitbucket.org/account/settings/ssh-keys/? Or did you add it to the Access keys of a repo?
Access keys provide read-only access to repos they are added to, so you won't be able to push. They are usually used for CI/CD systems that only need to clone a repo. If you want to be able to push as well, you will need to add the public SSH key to your account (after removing it from the repo's Access keys).
2. Assuming you use OpenSSH as a client, I suggest adding the following to the ~/.ssh/config file on your computer (if the file doesn't exist you can create it)
Host bitbucket.org
AddKeysToAgent yes
IdentityFile ~/.ssh/{ssh-key-name}
where {ssh-key-name} is the name of the private SSH key, whose public key you have added to your Bitbucket account. This key should exist in the ~/.ssh directory on your computer.
This config will ensure that this specific SSH key will be used every time you clone, pull or push to a Bitbucket repo via SSH
Please feel free to let me know how it goes and if you have any questions!
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.