I need to use git from a directory located in Desktop. When I use ssh <url> it gives
no such identity: .ssh/id_rsa: No such file or directory
Permission denied (publickey)However, I can connect to the server if I shh from home directory. How I can update ./ssh to make it accessible from any directory?
21 Answer
It seem like you may have made an error when setting up git to use the ssh keys. The error would be using the path .ssh/id_rsa when really you needed ~/.ssh/id_rsa, which will tell the ssh-agent to look in the .ssh directory in your home directory. Currently it will be searching for the .ssh directory in the current directory, which is why it works when you're in the home directory.
Assuming that you set up your ssh keys in a manner similar to the github tutorial, you'll need to remove your faulty configuration from the ssh-agent, and add the key with the correct path.
To remove the incorrect key, while in your home directory:
ssh-add -d .ssh/id_rsaAdd the key with the correct path:
ssh-add ~/.ssh/id_rsaThe key should now be available from any directory.
2