Home > database >  eval is not recognised on Windows
eval is not recognised on Windows

Time:09-22

I am beginner and I'm trying to connect my GitHub profile with my local machine.

I'm following the steps but my git cmd does not recognise eval. I have generated a key and am trying to add an SSH key to the ssh-agent.

This is the message I get:

'eval' is not recognized as an internal or external command, operable program or batch file.

The command I run is:

eval "$(ssh-agent -s)"

CodePudding user response:

You are running the command in the wrong console.

Open Powershell, Git Bash console or WSL bash - depending on how you installed Git - because this is just Command Prompt (cmd.exe) which doesn't support even the syntax you're trying (Bash).

Or alternatively, ensure ssh-agent's folder is in the PATH environment variable. Then you'll be able to call it even from a different console, that is, a part of the eval $(ssh-agent -s) command.

What that part does is nevertheless incompatible with the Command Prompt console:

     -s      Generate Bourne shell commands on stdout.  This is the default if
             SHELL does not look like it's a csh style of shell.

and outputs something like this:

SH_AUTH_SOCK=/tmp/ssh-jR0WcW41z0yX/agent.1918430; export SSH_AUTH_SOCK;
SSH_AGENT_PID=1918431; export SSH_AGENT_PID;
echo Agent pid 1918431;

which might be worked around by using Command Prompt's SET command like this:

set SH_AUTH_SOCK=c:\some\path\agent.1918430
set SSH_AGENT_PID=<the number you got>

and then run the commands following that eval $(ssh-agent -s) instruction.

  • Related