I am trying to configure ssh for use with github on a new computer. I've attempted to follow the instructions listed in the tutorial on github to no avail. Here's a summary.
Using my M1 mac's (macOS 12.6) terminal console, I first check that I have created a public private key pair. The command ls -la ~/.ssh
produces
drwxr-xr-x 6 <user> staff 192 Sep 16 21:26 .
drwxr-xr-x+ 34 <user> staff 1088 Sep 17 07:12 ..
-rw-r--r-- 1 <user> staff 75 MMM DD HH:MM config
-rw------- 1 <user> staff 2655 MMM DD HH:MM id_rsa
-rw-r--r-- 1 <user> staff 571 MMM DD HH:MM id_rsa.pub
-rw-r--r-- 1 <user> staff 92 MMM DD HH:MM known_hosts
It appears I have a private key with owner read/write permissions. I then check the contents of the private key file with cat ~/id_rsa
. The terminal prints
-----BEGIN OPENSSH PRIVATE KEY--—-
random looking stuff
-----END OPENSSH PRIVATE KEY--—-
Next I check the config file (just in case it's relevant) with cat ~/.ssh/config
and I get
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Now I start the ssh-agent with eval "$(ssh-agent -s)"
and I get Agent pid XXX
. Great. I run ssh-add ~/.ssh/id_rsa
. The terminal asks for my private key passphrase, which I enter, and it finishes silently. Finally, to check that the operation was successful I run 'ssh-add -l
, and the result says
The agent has no identities.
For good measure, I try adding the public key to my github account and I try connecting to git with ssh -vT [email protected]
. I see a line saying
debug1: Server accepts key: /Users/<username>/.ssh/id_rsa
It asks me for my passphrase, which I enter, and it says
[email protected]: Permission denied (publickey).
Anyone have any ideas about what might be going on? Why isn't the ssh-add
being successful? Thanks.