Skip to content

fix(start-ssh-agent): support OpenSSH 10.1+ socket location#183

Merged
dscho merged 2 commits intogit-for-windows:mainfrom
SvenStaehs:dev/new-socket-location
Feb 5, 2026
Merged

fix(start-ssh-agent): support OpenSSH 10.1+ socket location#183
dscho merged 2 commits intogit-for-windows:mainfrom
SvenStaehs:dev/new-socket-location

Conversation

@SvenStaehs
Copy link

@SvenStaehs SvenStaehs commented Feb 3, 2026

Description

Since Git for Windows upgraded to OpenSSH 10.2.P1 (which includes changes from OpenSSH 10.1), the start-ssh-agent.cmd script fails to locate ssh-agent sockets.

Root Cause

OpenSSH 10.1 moved agent sockets from /tmp to ~/.ssh/agent/ as a security improvement. From the OpenSSH 10.1 release notes:

ssh-agent(1), sshd(8): move agent listener sockets from /tmp to under ~/.ssh/agent for both ssh-agent(1) and forwarded sockets in sshd(8).

This ensures processes that have restricted filesystem access that includes /tmp do not ambiently have the ability to use keys in an agent.

Proposed Fix

This PR updates the script to search %USERPROFILE%\.ssh\agent\ instead of %TEMP%\ssh-* to align with OpenSSH's new default socket location.

Why not use -T?

The -T flag exists to force the old /tmp location but would revert the security improvement. The proper fix is updating the script to match OpenSSH's new default.

This fixes git-for-windows/git#6084

Update socket search paths from "%TEMP%\ssh-*" to "%USERPROFILE%\.ssh\agent\s.*" to align with OpenSSH 10.1+ security improvement that moved agent sockets from /tmp to $HOME

This preserves the security benefits of restricting filesystem access while maintaining compatibility with the new default location.

Signed-off-by: SvenStaehs <staehs.sven@siemens.com>
@SvenStaehs SvenStaehs force-pushed the dev/new-socket-location branch from 6858184 to b8b777f Compare February 3, 2026 15:02
Signed-off-by: SvenStaehs <staehs.sven@siemens.com>
Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

@dscho dscho merged commit 3fde392 into git-for-windows:main Feb 5, 2026
3 checks passed
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

Successfully merging this pull request may close these issues.

start-ssh-agent.cmd incompatible with OpenSSH 10.1+ security improvement (agent socket relocation)

2 participants