I have ssh setup in ~/.config/ssh
instead of the default ~/.ssh
.
Every time I do a git pull
or git push
, I get the below message:
The authenticity of host 'github.com (192.30.255.112)' can't be established.
RSA key fingerprint is SHA256:....
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Failed to add the host to the list of known hosts (/Users/username/.ssh/known_hosts).
After entering yes, the next step of adding the host to the known_hosts
fails, but the operation (git pull
and git push
) completes successfully.
There is no ~/.ssh
(and thereby no ~/.ssh/known_hosts
) after the operation completes.
The location of my known hosts file is: ~/.config/ssh/known_hosts
.
I have already done:
ssh -o UserKnownHostsFile=~/.config/ssh/known_hosts -T git@github.com
and
eval $(ssh-agent)
ssh-add -K ~/.config/ssh/id_rsa
and also added the SSH keys to my github profile using pbcopy < ~/.config/ssh/id_rsa.pub
.
Contents of ~/.config/ssh/config
:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.config/ssh/id_rsa
Contents of ~/.config/ssh/known_hosts
:
github.com,192.30.255.112 ssh-rsa ...
...
...==
192.30.255.113 ssh-rsa ...
...
...==
File permissions of ~/.config/ssh
:
drwxr-xr-x 6 username staff 192 Aug 29 19:12 .
drwxr-xr-x 7 username staff 224 Aug 29 16:17 ..
-rw-r--r-- 1 username staff 83 Aug 29 19:01 config
-rw------- 1 username staff 3434 Aug 29 19:00 id_rsa
-rw-r--r-- 1 username staff 747 Aug 29 19:00 id_rsa.pub
-rw-r--r-- 1 username staff 803 Aug 29 19:31 known_hosts
EDIT:
Doing ssh -o UserKnownHostsFile=$HOME/.config/ssh/known_hosts git@github.com
gives:
git@github.com: Permission denied (publickey)
How do I avoid entering 'yes' at every git pull
and git push
?