Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH_AUTH_SOCK is not set when using SSH Agent #1136

Closed
russellseymour opened this issue Apr 17, 2018 · 7 comments
Closed

SSH_AUTH_SOCK is not set when using SSH Agent #1136

russellseymour opened this issue Apr 17, 2018 · 7 comments

Comments

@russellseymour
Copy link

"OpenSSH for Windows" version
7.6.1.0

Client OperatingSystem
Windows 10 Pro

What is failing

I have successfully got SSH Agent working to hold my private key so I am able to SSH into remote machines without the need to enter my password.

However I also use the same SSH key for my Git operations.
Each time I use git push it asks me for my password even though my key is in the agent.

Digging into this it seems that Git uses the env var SSH_AUTH_SOCK to access the agent and thus the key. This env var is not being set at all and does not exist.

Expected output

It is my understanding that running ssh-agent on its own should give me back the SSH_AUTH_SOCK and SSH_AGENT_PID but I get nothing back at all from ssh-agent when run in a terminal (elevated or otherwise).

(The SSH Agent service is running)

Actual output

No output from ssh-agent and no environment variables set.

@manojampalam
Copy link
Contributor

ssh-agent on Windows, currently works a bit different than how it does on Unix.

Its implemented as a service and exposed on a named pipe. The name of this name pipe is static and all ssh binaries assume this static one, if SSH_AUTH_SOCK is not explicitly set.

Given your observations, it looks like Git on your machine is invoking a different version of ssh client. Double check what version of ssh.exe is being invoked (in task manager) when you are being prompted for the password.

@bagajjal
Copy link
Collaborator

bagajjal commented Apr 17, 2018

This link should help.
You need client side changes to use our win32-openssh client.

@russellseymour
Copy link
Author

Thank you very much for this.

I set the GIT_SSH_COMMAND environment variable as the link states and everything started working :-).

@bagajjal bagajjal self-assigned this Apr 19, 2018
@roblourens
Copy link

The name of this name pipe is static and all ssh binaries assume this static one, if SSH_AUTH_SOCK is not explicitly set.

What is the name of this pipe? I can't find it mentioned in any docs and have no idea where to look in the code.

@heilkn
Copy link

heilkn commented Jun 7, 2019

I am facing a similar issue. I need to forward SSH_AUTH_SOCK to a docker container. Is there any way to achive this?

Kind regards

@manojampalam
Copy link
Contributor

name of the pipe is: \.\pipe\openssh-ssh-agent
Agent forwarding is not supported on the server yet, but you should be able to use the client to forward agent to a non-Windows target.

@heilkn
Copy link

heilkn commented Apr 16, 2020

Dear @manojampalam

Thank you very much for this information. I could successfully mount the pipe into a windows docker container. When I run ssh-add in the container it does recognize the pipe. I know this, because it complains if I do not mount it. However, running ssh-add -l does not list any keys. :(

Any advice, what is missing here?

Kind regards

Konstantin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants