You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ssh-agent broken in 2.51.0 for users with space in username #5893
Error message claiming the socket cannot be accessed
Please refrain from such vague reports. If there is an error message, you need to paste it (if there is anything sensitive, you need to redact it of course). Handwaving bug reports are frustrating and therefore counterproductive.
Okay, let's pinpoint this further: Does the same happen with a regular MSYS2 (after installing ssh with pacman -Sy openssh and specifically overriding the home directory by prefixing the db_home line in /etc/nsswitch.conf with env so that it looks like the one of Git Bash's)?
Also, how certain are you that you quoted ssh-agent -s in eval "$(ssh-agent -s)"?
I used back quote in the .bashrc script and not double quotes. It worked and started to break with 2.51.0. Noticed the agent socket was on /tmp before and is now under $HOME with 2.51.0
Okay, let's pinpoint this further: Does the same happen with a regular MSYS2 (after installing ssh with pacman -Sy openssh and specifically overriding the home directory by prefixing the db_home line in /etc/nsswitch.conf with env so that it looks like the one of Git Bash's)?
Noticed the agent socket was on /tmp before and is now under $HOME with 2.51.0
That is indeed new, it is a change introduced in OpenSSH. It is discussed (among other places) here.
So you have two options: either use the -a option of ssh-agent (opening yourself up to what's commonly known as "relative path attacks"), or surround your back-ticked ssh-agent invocation with double quotes (as is actually recommended in a lot of places on the internet).
Noticed the agent socket was on /tmp before and is now under $HOME with 2.51.0
That is indeed new, it is a change introduced in OpenSSH. It is discussed (among other places) here.
So you have two options: either use the -a option of ssh-agent (opening yourself up to what's commonly known as "relative path attacks"), or surround your back-ticked ssh-agent invocation with double quotes (as is actually recommended in a lot of places on the internet).
Double quotes do not resolve the issue:I tried eval "$(ssh-agent -s)" but got the same error beccause it seems eval cannot process:
Thank you for git-for-windows/git-for-windows.github.io#80! Is there anything else you would need here? Otherwise I think we can close this, as it is really an OpenSSH bug that it does not quote the path in the eval'able output of ssh-agent.
Thank you for git-for-windows/git-for-windows.github.io#80! Is there anything else you would need here? Otherwise I think we can close this, as it is really an OpenSSH bug that it does not quote the path in the eval'able output of ssh-agent.
Activity
dscho commentedon Oct 20, 2025
Please refrain from such vague reports. If there is an error message, you need to paste it (if there is anything sensitive, you need to redact it of course). Handwaving bug reports are frustrating and therefore counterproductive.
jeffmaury commentedon Oct 20, 2025
Output of eval
ssh-agent -sis:where my home folder is C:\Users\Jeff Maury
Then running
ssh-add:Could not open a connection to your authentication agent.dscho commentedon Oct 20, 2025
Okay, let's pinpoint this further: Does the same happen with a regular MSYS2 (after installing
sshwithpacman -Sy opensshand specifically overriding the home directory by prefixing thedb_homeline in/etc/nsswitch.confwithenvso that it looks like the one of Git Bash's)?dscho commentedon Oct 20, 2025
Also, how certain are you that you quoted
ssh-agent -sineval "$(ssh-agent -s)"?jeffmaury commentedon Oct 20, 2025
I used back quote in the .bashrc script and not double quotes. It worked and started to break with 2.51.0. Noticed the agent socket was on /tmp before and is now under $HOME with 2.51.0
jeffmaury commentedon Oct 20, 2025
Yes same erros happen
dscho commentedon Oct 20, 2025
That is indeed new, it is a change introduced in OpenSSH. It is discussed (among other places) here.
So you have two options: either use the
-aoption ofssh-agent(opening yourself up to what's commonly known as "relative path attacks"), or surround your back-tickedssh-agentinvocation with double quotes (as is actually recommended in a lot of places on the internet).dscho commentedon Oct 20, 2025
And if you were following the guidance provided at https://gitforwindows.org/auto-launching-ssh-agent-when-git-starts.html#manually, it would be a really nice thing if you could open a PR to fix that.
jeffmaury commentedon Oct 20, 2025
Double quotes do not resolve the issue:I tried eval "$(ssh-agent -s)" but got the same error beccause it seems eval cannot process:
SSH_AUTH_SOCK=/c/Users/Jeff Maury/.ssh/agent/s.acw9j72LaJ.agent.zwtScelcZJ; export SSH_AUTH_SOCK;
which is the first line generated by ssh-agent -s
jeffmaury commentedon Oct 20, 2025
Seems changing from ssh-agent -s to ssh-agent -T does the trick, let me know if you want me to provide a PR for the documentaiton
dscho commentedon Oct 20, 2025
Yes, please!
dscho commentedon Oct 21, 2025
Thank you for git-for-windows/git-for-windows.github.io#80! Is there anything else you would need here? Otherwise I think we can close this, as it is really an OpenSSH bug that it does not quote the path in the
eval'able output ofssh-agent.jeffmaury commentedon Oct 22, 2025
Yes I think we can