Facing a problem while pushing the changes to remote.
I have added the ssh keys, but still facing the issue.
"Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists."
This is happening after upgrading my mac.
Thanks in advance.
Hello @Upendra Cheedella and welcome to the Atlassian Community!
The error message "Permission denied (public key)" can have multiple causes that are discussed in the article Bitbucket Knowledge Base - Permissions denied (public key).
I would suggest checking if you have added your SSH key directly to a repository or project (which are called Access Keys), or to your Bitbucket account. This is because access keys provide only read access to the repository, so you will not be allowed to push. In this case, you will need to remove the access key from the repo/project and instead add the SSH key to your account under Profile avatar (top right corner) > Personal Settings > SSH Keys.
Also, to make sure that SSH is using the correct key, I would recommend creating a file named config (it has no extension) under the folder ~/.ssh/ with the following content :
Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/<name of your private SSH key>
IdentitiesOnly yes
The IdentityFile property should contain the path to the private SSH key you have on your machine.
If after following those steps you are still receiving the public key error, we kindly ask you to share the output of the git push command including verbose logs :
GIT_TRACE_PACKET=1 GIT_TRACE=1 GIT_SSH_COMMAND="ssh -vvv" git push
This will bring additional logs, such as the SSH keys being used, so we can investigate further.
Thank you, @Upendra Cheedella !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.