Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

issue with git push

Ian Acklam
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 12, 2024

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

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 16, 2024

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events