How to fix warning: Identity file github not accessible: No such file or directory?
This is what is working for me:
Host github
User git
Hostname github.com
IdentityFile ~/.ssh/id_rsa
The IdentityFile
should point to the existing identify file. You can use tilde (~) which refer to a user's home directory.
Basically the error:
Warning: Identity file /home/freinn/github not accessible: No such file or directory.
saying that this file is missing, therefore you've to create one (using ssh-keygen
), or point to the existing DSA, ECDSA or RSA authentication identity file or use the default file (by removing or commenting out the line).
Also, in the host line (Host github
), you can specify the host pattern such as alias which you want to use, so you can use git@github
instead of using full host. Normally you want to use specific host entry, however you can also use a wildcard character (*
) which will apply global settings for all hosts.
Check further information by running man ssh_config
command.
To get SSH authentication working for GitHub, you need to create a public/private key pair as per GitHub's instructions. The IdentityFile
option should point at whatever file contains the private key you created while performing those instructions.
It looks like you're connecting just fine anyway* — you're seeing GitHub's successful connection message. Maybe your GitHub private key is just ~/.ssh/id_rsa
? If so, you could remove the IdentityFile
line altogether and it'll work as expected.
If it's any help, the relevant section of my ~/.ssh/config/
looks as follows:
Host github.com
IdentityFile ~/.ssh/id_rsa_github
IdentitiesOnly yes
…but that works only because ~/.ssh/id_rsa_github
is where I put my GitHub-specific private RSA key.
*GitHub always responds with You've successfully authenticated, but GitHub does not provide shell access.
when you successfuly ssh
in from a shell.