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

when I try to push my source code to bitbucket I receive an authentication error

Jazib Khan
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!
August 3, 2023

while running this command I get this error and I am unable to understand and solve this 

git push -u origin --all

git@bitbucket.org: Permission denied (publickey).

fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights

and the repository exists.

1 answer

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 7, 2023

Hi @Jazib Khan and welcome to the community!

There are different possible causes for this error.

1. One possibility is that you don't have access to the repo.

2. Have you already set up SSH keys? If so, where did you add the public SSH key?

In case the public key was added to your account's settings and you have at least write access to the repo, then this is not an issue. In case the public key has been added as an Access key to a project or repo, these types of keys provide read-only access.

3. If the public key has been added to your account, then the private SSH key may not be offered during the git push operation.

I would suggest creating a file named config in your ~/.ssh folder and adding the following lines (if the file exists, just add the following content)

Host bitbucket.org
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa

where ~/.ssh/id_rsa replace with the path and name of the private SSH key, whose public key you have uploaded to Bitbucket.

This will ensure that the correct SSH key is used when connecting to Bitbucket.

Reference: https://support.atlassian.com/bitbucket-cloud/docs/set-up-personal-ssh-keys-on-macos/#Add-your-key-to-the-SSH-agent

Please feel free to let me know how it goes and if you need further assistance.

Kind regards,
Theodora

Suggest an answer

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

Atlassian Community Events