DEV Community

jastuccio
jastuccio

Posted on

Fixing "git@github.com: Permission denied (publickey)"

I run into this error when I haven't used GitHub in a while. There is a simple fix to reconnect your SSH key. The syntax is a bit different than most online answers because I use FISH(Friendly Interactive shell).

in BASH the command should be eval $(ssh-agent -s)
in FISH type eval (ssh-agent -c)

A slight difference but figuring this out almost drove me nuts the first time.

Next type ssh-add path/to/your/ssh-key

Now the error should be resolved.

If you need to generate SSH keys this might help
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

Top comments (0)