The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Permission denied when trying git push

Daiyue Weng
July 19, 2024

Hi,

I have created a new repo on Bitbucket and created two branches, i.e. main and develop using the Web UI.

I initialised my local repo, added and committed the files I wanted to upload to the cloud repo and added remote origin, then tried to push the local changes to the remote repo. But I got the permission denied error and couldn't proceed.

git push -u origin develop

 

The authenticity of host 'bitbucket.org (185.166.141.9)' can't be established. 
ED25519 key fingerprint is SHA256:ybgmFkzwOSotHTHLJgHO0QN8L0xErw6vd0VhFA9m3SM.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'bitbucket.org' (ED25519) to the list of known hosts.

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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

Hi Daiyue,

Based on the error message, you are using SSH to interact with this repo.

I suggest checking the following two things:

1. Have you generated an SSH key pair on the computer you are pushing from? And have you added the public key to your SSH keys here https://bitbucket.org/account/settings/ssh-keys/?

2. If you have setup the SSH keys, and assuming that you use OpenSSH as a client, try adding the following lines in the ~/.ssh/config file on this computer:

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

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

If the file config doesn't exist in the ~/.ssh/ directory, you can create it and add the content above. This will ensure that this specific SSH key will always be offered when you clone, pull, or push to a Bitbucket repo.

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

Kind regards,
Theodora

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events