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_rsa
Add the key with the correct path:
The key should now be available from any directory.