Tuesday, July 06, 2021

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

Error looks like:
$ git pull 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.
Assuming that you aready confirmed that you added your ~/.ssh/id_rsa.pub or similar to bitbucket personal preferences and that did not help, then you might want to to just try to connect via SSH to bitbucket with the below command which tries to connects to bitbucket.org via SSH with user git without allocating a TTY and in verbose mode:
ssh -Tv git@bitbucket.org
You should get something similar to the below:
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 logged in as git You can use git to connect to Bitbucket. Shell access is disabled
If that is the case then you you should retry your git commands again because they should work now.