OpenSSH with git for windows

4,392 views
Skip to first unread message

Miha

unread,
Jan 15, 2019, 9:09:54 AM1/15/19
to git-for-windows
Hey guys,

I am using OpenSSH provided by Windows 10. I have the ssh-agent running with all my Git SSH keys loaded, however when I do a git clone, like

git clone g...@github.com:git-for-windows/git.git

I get asked for my key passwod. I use cmder with git-for-windows. Is git for windows not connecting to the ssh-agent or is this an unsupported setup?

Thanks in advance

Ilia Basin

unread,
Jan 15, 2019, 9:28:57 AM1/15/19
to git-for-windows
Please do in git bash:

    echo $SSH_AUTH_SOCK


вторник, 15 января 2019 г., 17:09:54 UTC+3 пользователь Miha написал:
Hey guys,

Miha

unread,
Jan 15, 2019, 12:28:04 PM1/15/19
to git-for-windows
I get the following:

C:\Users\miha        
λ echo $SSH_AUTH_SOCK
$SSH_AUTH_SOCK       
                     
C:\Users\miha        
λ ssh-add -l         
4096 SHA256:b44+7uqDG
4096 SHA256:JyZLZepAy
                     
C:\Users\miha        
λ                    

Does this mean the env variable is not set?

Ilia Basin

unread,
Jan 15, 2019, 12:52:55 PM1/15/19
to git-for-windows
Miha, the "git bash" shortcut looks like in the attached image:

What you were using is the Windows Command Prompt. It's a different thing and a different syntax to echo an environment variable.

вторник, 15 января 2019 г., 20:28:04 UTC+3 пользователь Miha написал:

Miha

unread,
Jan 15, 2019, 2:00:48 PM1/15/19
to git-for-windows
You are correct.

I get this on Git Bash.

Capture.PNG

So ssh-add cannot be found with git bash but works fine with cmd, why could that be?



On Tuesday, January 15, 2019 at 3:09:54 PM UTC+1, Miha wrote:

Ilia Basin

unread,
Jan 15, 2019, 2:43:08 PM1/15/19
to git-for-windows
Beside ssh.exe installed with Git For Windows there should be another ssh.exe provided by OS. If you manage to force git to use this ssh client, it might work.
The reason is Windows SSH agent uses a fixed named pipe address and the clients provided by windows work without $SSH_AUTH_SOCK set.

- Test that
  C:\path\to\another\ssh.exe
  can use the agent
 
- set the environment variable
  GIT_SSH=C:/path/to/another/ssh.exe

вторник, 15 января 2019 г., 22:00:48 UTC+3 пользователь Miha написал:

Miha

unread,
Jan 16, 2019, 3:01:25 PM1/16/19
to git-for-windows
Yup setting the environment variable to :

GIT_SSH=C:/Windows/System32/OpenSSH/ssh.exe

actually works fine. Thanks a lot for the help!

Would be nice if this was a bit more plug & play, not sure how exactly how though. Maybe git-for-windows could detect a native OpenSSH implementation installed.

Thanks again!

Miha

Johannes Schindelin

unread,
Jan 16, 2019, 3:56:04 PM1/16/19
to Miha, git-for-windows
Hi Miha,

If you really feel strongly enough that this would be a nice thing to
have, you should feel quite encouraged to pursue
https://github.com/git-for-windows/git/issues/1981

"If wishes were horses, beggars would ride"

At least with open source you don't have to be a beggar. You can ride all
the way to your first PR without asking *anyone* for permission.

Ciao,
Johannes
> --
> You received this message because you are subscribed to the Google Groups "git-for-windows" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to git-for-windo...@googlegroups.com.
> To post to this group, send email to git-for...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/git-for-windows/9d0acec5-6f12-4793-a001-d5b6b1809c5b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

Miha

unread,
Jan 16, 2019, 4:21:49 PM1/16/19
to git-for-windows
Thanks for pointing that out, I will see what I can do.

Best,

Miha
Reply all
Reply to author
Forward
0 new messages