-
Notifications
You must be signed in to change notification settings - Fork 766
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
Can't get ssh-agent working #1133
Comments
I assume that Make sure you're using the correct ssh-add.exe and that the |
UPDATE: Oh, you said UNSET %SSH_AUTH_SOCK%. Yeah, that did the trick. I'll figure out what is setting it and take care of that. Thanks :) I'm definitely using the ssh from this OpenSSH port:
But interestingly,
Which appears to be a valid path (in PowerShell) to
|
It was coming from posh-git. There's an effort to separate out ssh from posh-git[0] which maybe will make the two play well together, but for now I just uninstalled posh-git. |
For anyone who also comes across this issue who wants to use the ssh agent service that ships as part of the Win10 spring update and is using posh-git, a simple fix is just to delete the environment variables inside your profile after importing the posh-git module. Eg:
|
I just came to this issue after a fresh install (last night) of Win 10 Edu 1803. I don't have either SSH_AGENT_PID or SSH_AUTH_SOCK set, but still get:
or
Note that the SSH client was also NOT installed by default, and after installation didn't show up in my path right away (though seems to have done so eventually?). EDIT: nevermind, worked this time when I ran in an administrative shell (it wasn't working before). I guess there is some async stuff that Windows 10 is doing in the background? |
For anyone else looking to fix this issue that uses Scoop. I had this error thrown when I had pshazz installed using Scoop.
Uninstalled, and error went away. Hope this helps! UPDATE: I saw this error over on pshazz lukesampson/pshazz#70 and @myty had a comment that solved this for me too, without uninstalling pshazz. Go take a look, and if it works give him a well deserved thumbs up! |
Just ran in to this myself and found that the "Startup Type" for the ssh-agent service was set to "Disabled". I changed that to "Manual" and was able to start the service normally. |
@rageshkrishna what's your openssh version? |
I don't have an exact version number at the moment, but it was whatever came with the "OpenSSH Server" feature in Windows 10 (build 1803). |
If so, this is expected, ssh-agent was set to disabled in the recent Windows 10 update. You'll have to enable it explicitly if you need it. |
Hey that was my issue too: |
On my Windows there is even no ssh-agent service. |
Looks like you may have Developer mode on. Can you disable those legacy services and see if you have ssh.exe and ssh-agent.exe installed under %windir%\system32\openssh ? If you dont see them there - can you try installing OpenSSH using steps similar to what's detailed here (these were for Beta, your entries wouldn't have "Beta" in them) - https://blogs.msdn.microsoft.com/powershell/2017/12/15/using-the-openssh-beta-in-windows-10-fall-creators-update-and-windows-server-1709/ |
Ok, developer mode is removed, those files exist but still the same message. And starting it using PowerShell gives this: Start-Service : Service 'OpenSSH Authentication Agent (ssh-agent)' cannot be started due to the following error: Cannot
|
You could do the following to set ssh-agent back to "auto" on-demand start: |
Thanks. This also helped. Set-Service -name "ssh-agent" -startuptype "automatic" |
@egbertn I have the same problems |
For some reason it was disabled, just had to flick it to manual
Then to make sure it's running
|
This works to start the service and I can successfully add keys, however, when trying to ssh to some server it seems to ignore the keys added and always asks for password :( |
Are you sure? Its quite likely that your server is rejecting the key and asking for password. |
I’m sure, server has password login disabled. Also, I tried other servers / keys and they work fine on a Ubuntu box. |
can you try ssh with -vvv flags and confirm from its traces that the key is indeed picked up/not ? |
@manojampalam here is my debug and an everything I tried:
Installed via
Started the service:
Added the key:
Now the ssh command:
In my
If I add Also, I was reading previous comments again, and I don't have an
However, when I'm using I also tried to use only windows directory separators What am I missing here? The full output of the Many thanks. |
I've finally found the cause of my problem! In my
Apparently, if one sets Setting |
Thanks for following up. This is something that I was unaware of too. |
The included version of OpenSSH in windows is mainly causing issues, and it is not clear how this ssh client is installed (When did Microsoft stop checking compability before releasing.) I had to spend half a day to get my workflow with poshgit running again. Posting here for anyone else that this causes issues for. |
Are you using different ssh-agent/ssh,exe client then? Is it the one provided with Git for Windows? Or maybe the Linux native installation? I am browsing for answers everywhere to get my VSCode connect Git by ssh under windows and nothing helps. |
Ugh, so I had everything working for a very long time and now suddenly
|
My solution was found randomly on a Linux forum.
and the solution was to run it like:
|
I'm having similar issue, but the agent is running correctly and can be seen from the services that it is really running. I was able to solve this issue by connecting my laptop back to our company's domain. This is really annoying feature. We have a script which makes a network-drive as a home directory. I tried to put an environmental variable which points to local drive but it does not work. Only workaround is to connect machine physically to company's network on with a VPN. I don't have any issues at my home PC which is not bound to any Domain service active directory shitty-shitty. Starting to feel that I need to make some sort of a Docker-based workaround. I think I am reasonably good at googling information, but in this case the terminology (mostly issues in Linux) distracts the searching a lot. |
In my case I found the service disabled, not sure how that happened but running following fix it: Set-Service ssh-agent -StartupType Manual |
I had to make a minor change, but that helped me too: .'C:\Program Files\Git\usr\bin\ssh-agent.exe' 'C:\Program Files\Git\usr\bin\ssh-add.exe' $env:home\.ssh\id_rsa |
If the command don't work (in vscode for my case), change the StartType by the Gui
|
@manojampalam can you explain why you think this is expected behavior?
The link you posted states this:
So in my reading, |
In on Windows 10: you need to allow the C:\Windows\System32\OpenSSH\ exe files to have access to the controlled folder access (i.e. sudo rights) in windows using the modern windows security settings app. It is a permissions issue with Windows. |
how do I do that? |
@bittikettu |
This seemed to fix things, why this is required is puzzling at best |
WHAT. THE. Fizzle-eff. Why does this work?!? I literally just did the same thing - works. This is on my work laptop...soooo...maybe some weird policy thing? |
Same behavior here! Looks like I'm not the only one |
I'm also having this issue now @dariopnc . All my keys are asking for password / the agent doesn't seem to be working anymore. Maybe this was related to the latest updates do the Terminal/PowerShell and/or OpenSSH? Microsoft decides to update stuff automatically without asking or telling anything to anyone and then this happens. |
Please answer the following
"OpenSSH for Windows" version
7.6.0.0
Windows 10 Pro
What is failing
C:\src> ssh-add C:\Users\alan\.ssh\ripper\ripper_id_rsa
Expected output
shrug
Actual output
Diagnostics
I used procmon to discover that the failed file open operation is on a file called 'C:\tmp\ssh-DEhw9URW70Jz\agent.24500' which does NOT exist. In fact, the c:\tmp directory doesn't exist.
I installed OpenSSH using
choco install -y openssh -params '"/SSHAgentFeature"'
and I verified that ssh-agent service is installed AND running.What was supposed to create 'C:\tmp\ssh-DEhw9URW70Jz\agent.24500' and how can I diagnose why it didn't?
The text was updated successfully, but these errors were encountered: