Search code examples
sshgit-bashssh-keyspermission-deniedssh-agent

Generating SSH key in git bash, i can't get git agent


When I am trying to generate SSH key in git bash, I can't get git agent when we run this command

eval $(ssh-agent -s)

then I will get this error

unix_listener: cannot listen on path /tmp/ssh-xoEnzGUu8XxU/agent.1287: Permission denied

How can I resolve this?


Solution

  • As seen here, that could be a permission issue for writing the SSH socket.
    Check the permission associated to /tmp or /tmp/ssh-xoEnzGUu8XxU/agent.1287

    Or try:

    eval $(ssh-agent -a ~/.ssh-agent.$$)
    

    The socket will be written in your $HOME instead of /tmp: no more permission issue.