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

Can no longer use ssh-add: Error connecting to agent #1781

Closed
1 of 3 tasks
dom-devel opened this issue May 23, 2018 · 15 comments
Closed
1 of 3 tasks

Can no longer use ssh-add: Error connecting to agent #1781

dom-devel opened this issue May 23, 2018 · 15 comments

Comments

@dom-devel
Copy link

Purpose of the issue

  • Bug report (encountered problems/errors)
  • Feature request (request for new functionality)
  • Question

Description of the issue

Can no longer add ssh keys using ssh-add. Instead I'm thrown the following error:

Error connecting to agent: No such file or directory

I believe this has started happening since the latest Windows update.

My set-up
I'm currently booting an ssh-agent at startup, having un-commented before:

call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd"

I'm running:

  • Windows 10
  • Latest preview/alpha
    image

Further debugging
I took a look at the environment variables set:

SSH_AUTH_SOCK & SSH_AGENT_PID

Both are set:

  • SSH_AUTH_SOCK: /tmp/ssh-yzpgZ44bVaMU/agent.17940
  • SSH_AGENT_PID: 4304

Which correctly creates into:

C:\Users\Dominic\AppData\Local\Temp\ssh-yzpgZ44bVaMU\agent.17940

I tried setting, SSH_AUTH_SOCK to the full windows path above, however at this point I then get:

Could not add identity ".ssh\id_rsa": invalid format

Apologies if this is an issue with ConEmu, I'm not knowledgeable enough to be able to separate the two cleanly.

@lneveu
Copy link

lneveu commented May 23, 2018

Same issue here after the latest Windows update :/
(with ConEmu version 161206)

@raulfragoso
Copy link

Same issue, with latest version (180506)

@Stanzilla
Copy link
Member

try which ssh-agent Windows 1803 comes with their own OpenSSH version by default now, you probably want to remove that from PATH

@lneveu
Copy link

lneveu commented May 24, 2018

Thanks @Stanzilla! I removed %SYSTEMROOT%\System32\OpenSSH\ from my PATH and it's working fine now :)

@raulfragoso
Copy link

Thanks @Stanzilla ! Works for me.

@dom-devel
Copy link
Author

Yep that's worked for me as well. Cheers @Stanzilla!

@SiqiLu
Copy link

SiqiLu commented Jun 2, 2018

@Stanzilla Thanks, that's worked for me.

@johncrim
Copy link

Another option (possibly better than using another copy of openssh) is to use the Windows ssh agent. Check status in powershell:

get-service ssh*

If the service is disabled, start it and set to manual:

Set-Service -Name ssh-agent -StartupType Manual
Start-Service ssh-agent

If there's a reason to use a git version of openssh instead of the windows-installed version, that would be good to know.

@Stanzilla
Copy link
Member

We need to support older versions of Windows as well

@scottfalkingham
Copy link

scottfalkingham commented Nov 13, 2018

Instead of removing %SYSTEMROOT%\System32\OpenSSH\ from your path, merely add the following to your user-profile.cmd file.

set "PATH=%GIT_INSTALL_ROOT%\usr\bin;%PATH%"

It will add git\usr\bin to your path again, but this time it comes before the %SYSTEMROOT%\System32\OpenSSH\ entry, which allows the ssh-agent calls to work again.

@EnverOsmanov
Copy link

If you are using default ssh client, you can switch git to use it too (answer was found here):
git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"

@tomsseisums
Copy link

@Stanzilla maybe you could use feature detection to set up default ssh for Windows version that support it or let that be the default and downgrade for non-native ssh?

@upugo-dev
Copy link

Instead removing %SYSTEMROOT%\System32\OpenSSH\ from you path, merely add the following to your user-profile.cmd file.

This seems like a much better solution than removing native OpenSSH from Windows path, which could have lots of consequences

@squaricdot
Copy link

Thanks @Stanzilla! I removed %SYSTEMROOT%\System32\OpenSSH\ from my PATH and it's working fine now :)

where did you remove it??? how did it got added in the first place?? by cmder?? why do that if it's wrong?? why do i need to spend 3 hours to get ssh-agent working with this software??

why do i need to google to many different github issues or PR or whatever to get any insight to enable this. as you might notice i'm going quite mental on this, at least it's a terrible and experience full of anger

@Stanzilla
Copy link
Member

Windows does that.

@cmderdev cmderdev locked as off-topic and limited conversation to collaborators Jun 26, 2019
@cmderdev cmderdev unlocked this conversation Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests