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

Permission denied (publickey)

EvanAad July 10, 2024

It's been a while since I last used Git. I have since upgraded my computer, and some files may have been deleted in the process.

I have tried to push my committed changes:

git push

I used to be able to do this with no issue, but now the action failed with the following error message.

no such identity: /Users/evanaad/.ssh/{bitbucket}: No such file or directory 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.

When I run

> cd ~
> ls

two of the listed files are `{bitbucket}` and `{bitbucket}.pub`.

However,

> ls -a .ssh

shows the following listings:

. .. config known_hosts known_hosts.old

When I browse to https://bitbucket.org/account/settings/ssh-keys/ there's a key there that is called "Default public key for iMac" and it has last been used mid April of this year.

 

Please help me resolve this problem, and push my committed changes.

 

My computer is iMac 1.5-inch, Late 2013 with some hardware upgrades.

My operating system is macOS Catalina Version 0.15.7 (19H2026).

My git version is 2.45.2

1 answer

1 accepted

1 vote
Answer accepted
EvanAad July 10, 2024

I managed to solve the problem on my own:

I followed some of the steps listed on this page:

1. I started an SSH agent using the command `eval $(ssh-agent)`.

2. I added my already existing private key to the agent using the command `ssh-add ~/{bitbucket}`.  When prompted to enter a passphrase, I used the passphrase I saved once upon a time on my passwords list under the name "iMac SSH for BitBucket".

3. I made sure the file ~/.ssh/config contained the following code:

Host bitbucket.org
    
AddKeysToAgent yes
    IdentityFile ~/.ssh/{bitbucket}

4. Finally, I ran `git push`. This time it worked.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events