WT and git bash ssh-add not accepting passphrase #9839

Closed
opened 2026-01-31 02:05:12 +00:00 by claunia · 8 comments
Owner

Originally created by @chrismetz on GitHub (Jul 25, 2020).

Environment

Windows build number: Windows Version 2004 (OS Build 19041.388)
Windows Terminal version (if applicable): 1.1.2021.0

Any other software?
git bash: 4.4.23(1)-release (installed with git for windows 2.27.0.windows.1)

Steps to reproduce

Unable to reliably reproduce, sometimes it works and other times it does not.

Expected behavior

  1. Start ssh-agent via eval $(ssh-agent -s)
  2. Add ssh key using ssh-add ~/.ssh/id_rsa
  3. Paste ssh key passphrase and have ssh key added.

Actual behavior

  1. Start ssh-agent via eval $(ssh-agent -s)
  2. Add ssh key using ssh-add ~/.ssh/id_rsa
  3. ssh key passphrase is not being accepted. In the below screen show I have attempted to insert the passphrase using ctrl + shift + V multiple times. When it was not accepted I exited the process with ctrl + c and attempted again. A no point did I change the value stored in the clipboard but it was finally accepted.

image

Originally created by @chrismetz on GitHub (Jul 25, 2020). # Environment Windows build number: Windows Version 2004 (OS Build 19041.388) Windows Terminal version (if applicable): 1.1.2021.0 Any other software? git bash: 4.4.23(1)-release (installed with git for windows 2.27.0.windows.1) # Steps to reproduce Unable to reliably reproduce, sometimes it works and other times it does not. # Expected behavior 1. Start ssh-agent via ***eval $(ssh-agent -s)*** 2. Add ssh key using ***ssh-add ~/.ssh/id_rsa*** 3. Paste ssh key passphrase and have ssh key added. # Actual behavior 1. Start ssh-agent via ***eval $(ssh-agent -s)*** 2. Add ssh key using ***ssh-add ~/.ssh/id_rsa*** 3. ssh key passphrase is not being accepted. In the below screen show I have attempted to insert the passphrase using ctrl + shift + V multiple times. When it was not accepted I exited the process with ctrl + c and attempted again. A no point did I change the value stored in the clipboard but it was finally accepted. ![image](https://user-images.githubusercontent.com/16770430/88443632-5bc26100-ce5c-11ea-810c-0249eb025eb3.png)
claunia added the Needs-TriageNeeds-Tag-FixNeeds-Attention labels 2026-01-31 02:05:12 +00:00
Author
Owner

@DHowett commented on GitHub (Jul 27, 2020):

Unfortunately, I can't reproduce this. If you can reproduce it using a test key with a fake password (because I'm going to ask you to capture an input log, and I don't want your actual password!), would you mind generating an input log?

generating an input log
  • Set the following values at the top level of Terminal settings
"debugFeatures": true,
  • Open a new tab in Terminal while holding down Left Alt and Right Alt
    • When you do this, you should get two panes, one of which contains VT sequences. Like this:

image

  • Repro the issue
  • Copy/paste the log out of the right pane, and perhaps include a screenshot (because copying it will strip the coloring)
@DHowett commented on GitHub (Jul 27, 2020): Unfortunately, I can't reproduce this. If you can reproduce it using a test key with a fake password (because I'm going to ask you to capture an input log, and I don't want your actual password!), would you mind generating an input log? <details> <summary>generating an input log</summary> * Set the following values at the top level of Terminal settings ``` "debugFeatures": true, ``` * Open a new tab in Terminal while holding down <kbd>Left Alt</kbd> **and** <kbd>Right Alt</kbd> * When you do this, you should get two panes, one of which contains VT sequences. Like this: ![image](https://user-images.githubusercontent.com/189190/88598033-5bbd8f00-d01d-11ea-8e34-a8ad26cb10f1.png) * Repro the issue * Copy/paste the log out of the right pane, and perhaps include a screenshot (because copying it will strip the coloring) </details>
Author
Owner

@chrismetz commented on GitHub (Jul 28, 2020):

@DHowett will do and I will get back to you

@chrismetz commented on GitHub (Jul 28, 2020): @DHowett will do and I will get back to you
Author
Owner

@chrismetz commented on GitHub (Jul 28, 2020):

@DHowett I was able to replicate using my existing key. The passphrase used came from a password manager so I am ok exposing it, I have also destroyed my key and removed it from anywhere that it was in use. Please see attached screen shot and log file.

ssh-add
ssh-add-log.txt

@chrismetz commented on GitHub (Jul 28, 2020): @DHowett I was able to replicate using my existing key. The passphrase used came from a password manager so I am ok exposing it, I have also destroyed my key and removed it from anywhere that it was in use. Please see attached screen shot and log file. ![ssh-add](https://user-images.githubusercontent.com/16770430/88601817-ccfc5100-d0b4-11ea-90c3-b8768a2187c5.png) [ssh-add-log.txt](https://github.com/microsoft/terminal/files/4985126/ssh-add-log.txt)
Author
Owner

@DHowett commented on GitHub (Jul 28, 2020):

This might seem weird, but.. the only difference between the working attempts and the failing attempts is that the passphrase when it works is ... a space character. In its entirety, the successful passphrase is a space character.

failing

| pressing ctrl,shift             | passphrase                     | releasing ctrl/shift           | pressing/releasing enter
^[[17;29;0;1;4;1_^[[16;54;0;1;20;1_b3bdf6b42fff16bbcbd8384fb1eef8cf^[[16;54;0;0;4;1_^[[17;29;0;0;0;1_^[[13;28;13;1;0;1_^[[13;28;13;0;0;1_
| pressing shift,ctrl              | passphrase                     | releasing ctrl/shift           | pressing/releasing enter
^[[16;54;0;1;16;1_^[[17;29;0;1;20;1_b3bdf6b42fff16bbcbd8384fb1eef8cf^[[17;29;0;0;16;1_^[[16;54;0;0;0;1_^[[13;28;13;1;0;1_^[[13;28;13;0;0;1_

(you got both ctrl-first and shift-first in the above trace; cool!)

also failing

| pressing ctrl/shift             |!| releasing ctrl/shift           | pressing/releasing VK 220            | pressing/releasing enter
^[[17;29;0;1;4;1_^[[16;54;0;1;20;1_␣^[[16;54;0;0;4;1_^[[17;29;0;0;0;1_^[[220;43;92;1;0;1_^[[220;43;92;0;0;1_^[[13;28;13;1;0;1_^[[13;28;13;0;0;1_

VK 220 corresponds to \| on a US-104 keyboard

succeeding

| pressing ctrl/shift             |!| releasing ctrl/shift           | pressing/releasing enter
^[[17;29;0;1;4;1_^[[16;54;0;1;20;1_␣^[[16;54;0;0;4;1_^[[17;29;0;0;0;1_^[[13;28;13;1;0;1_^[[13;28;13;0;0;1_

the , which I've marked with a ! (in the explainer above), is a space character. The debug engine uses ␣ to represent it because, well, spaces would otherwise be invisible 😄

Your password manager may blank the clipboard after a little bit, which might serve to explain why the behavior changes.

Any ideas?

@DHowett commented on GitHub (Jul 28, 2020): This might seem weird, but.. the only difference between the working attempts and the failing attempts is that the passphrase when it _works_ is ... a space character. In its entirety, the successful passphrase is a space character. ### failing ``` | pressing ctrl,shift | passphrase | releasing ctrl/shift | pressing/releasing enter ^[[17;29;0;1;4;1_^[[16;54;0;1;20;1_b3bdf6b42fff16bbcbd8384fb1eef8cf^[[16;54;0;0;4;1_^[[17;29;0;0;0;1_^[[13;28;13;1;0;1_^[[13;28;13;0;0;1_ | pressing shift,ctrl | passphrase | releasing ctrl/shift | pressing/releasing enter ^[[16;54;0;1;16;1_^[[17;29;0;1;20;1_b3bdf6b42fff16bbcbd8384fb1eef8cf^[[17;29;0;0;16;1_^[[16;54;0;0;0;1_^[[13;28;13;1;0;1_^[[13;28;13;0;0;1_ ``` (you got both ctrl-first and shift-first in the above trace; cool!) ### also failing ``` | pressing ctrl/shift |!| releasing ctrl/shift | pressing/releasing VK 220 | pressing/releasing enter ^[[17;29;0;1;4;1_^[[16;54;0;1;20;1_␣^[[16;54;0;0;4;1_^[[17;29;0;0;0;1_^[[220;43;92;1;0;1_^[[220;43;92;0;0;1_^[[13;28;13;1;0;1_^[[13;28;13;0;0;1_ ``` VK 220 corresponds to `\|` on a US-104 keyboard ### succeeding ``` | pressing ctrl/shift |!| releasing ctrl/shift | pressing/releasing enter ^[[17;29;0;1;4;1_^[[16;54;0;1;20;1_␣^[[16;54;0;0;4;1_^[[17;29;0;0;0;1_^[[13;28;13;1;0;1_^[[13;28;13;0;0;1_ ``` the `␣`, which I've marked with a `!` (in the explainer above), is a space character. The debug engine uses ␣ to represent it because, well, spaces would otherwise be invisible :smile: Your password manager may blank the clipboard after a little bit, which might serve to explain why the behavior _changes_. Any ideas?
Author
Owner

@chrismetz commented on GitHub (Jul 28, 2020):

🤦 @DHowett thank you, this has been driving me crazy. I use lastpass extension in chrome and wasn't aware that by default it cleared the clipboard after 60 secs.
Going by what you said above when I generated the key I created it with an empty passphrase due to the clipboard been cleared.

@chrismetz commented on GitHub (Jul 28, 2020): 🤦 @DHowett thank you, this has been driving me crazy. I use lastpass extension in chrome and wasn't aware that by default it cleared the clipboard after 60 secs. Going by what you said above when I generated the key I created it with an empty passphrase due to the clipboard been cleared.
Author
Owner

@DHowett commented on GitHub (Jul 28, 2020):

happy to help 😀

@DHowett commented on GitHub (Jul 28, 2020): happy to help 😀
Author
Owner

@dinyelum commented on GitHub (Jul 26, 2024):

@DHowett Thanks a lot for this answer. My passphrase was working on powershell but wasn't working on git bash, so I got really confused and I got tired of reading anything because I already read so many things from different sources including SO but none seemed to work. I wasn't going to read your answer too but then I just saw where you wrote something about ctrl and shift and I ran off to delete my previous keys and create new keys without touching either ctrl or shift and it worked! Thanks a lot man. Thanks @chrismetz for this question and for not giving up too.

@dinyelum commented on GitHub (Jul 26, 2024): @DHowett Thanks a lot for this answer. My passphrase was working on powershell but wasn't working on git bash, so I got really confused and I got tired of reading anything because I already read so many things from different sources including SO but none seemed to work. I wasn't going to read your answer too but then I just saw where you wrote something about ctrl and shift and I ran off to delete my previous keys and create new keys without touching either ctrl or shift and it worked! Thanks a lot man. Thanks @chrismetz for this question and for not giving up too.
Author
Owner

@DHowett commented on GitHub (Jul 26, 2024):

Wow, I'm happy I was able to help!

@DHowett commented on GitHub (Jul 26, 2024): Wow, I'm happy I was able to help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9839