I'm SSHing into my mac and doing some stuff remotely through tmux (namely uploading some stuff to github). When I just tried to run a git push, my command kept stalling silently. I found ssh stalling on this message, debug1: key_parse_private_pem: PEM_read_PrivateKey failed, and divined that the password prompt was being caught by the Keychain app and being displayed on the screen. I was able to get it to go through by using teamviewer to enter my password on-screen.

But how do I keep these private key prompts from going to the screen in the future? I'm fine with being prompted for my passphrase, but I would like it to happen in a terminal window in the future.

1 Answer 1


the password for your key is managed by ssh-agent and it defaults to ask for your password using the GUI you mentioned. You could:

  1. Unlock your key using the shell frontend to ssh-agent by calling ssh-add. In this case you might want to lock your key with ssh-add -D before you log out of the box.
  2. Circumvent ssh-agent by temporarily unsetting the SSH_AUTH_SOCK variable ssh uses to connect to the agent. You can do this for a single command like this

    SSH_AUTH_SOCK="" git push

    or for the whole shell session by calling unset SSH_AUTH_SOCK.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .