SSH connection from terminal works, but not from "git" commands

Hello all,

Today I started experiencing a new issue. When attempting to clone a remote repository, I received a Permission Denied(public key). For hours now I have followed all the steps to make sure my key matches the key in github, that I can connect using “ssh -T git@github.com”, that everything lines up properly. This has worked for a month now, and all of a sudden it will not. Everything I read online tells me to re add it, and or that I need to simply replace the key on the github side. I had done that 3 times now, and no luck

Again, my computer can ssh in perfectly fine using the suggested command line command by Github itself. But when I attempt to run “git clone” or “git push --set-upstream” I continually get this permission denial. Three keys later still nothing has changed.

Any idea what is happening or what else I should look into?

Do NOT do that! It will do nothing for outgoing connections, but make your own system significantly less secure by letting people log in as root with only a password. :warning:

@ThatGuySittin, if direct SSH works but Git commands that use SSH don’t, you can try using setting GIT_SSH_COMMAND to get debug info from SSH during the actual Git operation, e.g.:

GIT_SSH_COMMAND="ssh -v" git fetch

I hope that shows something useful, if not you could still share the result here and maybe someone will have an idea.

1 Like