Skip to content

Allow users to use Windows' OpenSSH binaries when available - #12734

Merged
sergiou87 merged 12 commits into
developmentfrom
windows-openssh
Aug 11, 2021
Merged

sergiou87 merged 12 commits into
developmentfrom
windows-openssh

Conversation

@sergiou87

@sergiou87 sergiou87 commented Aug 5, 2021 •

Copy link
Copy Markdown
Member

Closes #5641

Description

This PR introduces a new setting for users on Windows versions 10.0.17134 and newer, where there is a system OpenSSH available. New Windows installs will have this setting enabled by default, while existing installs will have this setting disabled in order to persist the existing behavior and avoid causing issues to users that already have everything set up and running.

Regarding the implementation, it just adds the -c core.sshCommand="C:\\Windows\\System32\\OpenSSH\\ssh.exe" parameter to all git calls.
I haven't managed to make this works on Windows 11 for ARM, it's like Desktop doesn't see that ssh.exe. I still have to test this on Windows 11 for x64 to see if it works there or if it's a Windows 11 issue.

EDIT: I just tested it and it doesn't work on ARM, but it does work on Windows 11 for x64 🎉

Screenshots

image

Release notes

Notes: [Improved] Windows users can now rely on the system OpenSSH for their git repositories.

@sergiou87
sergiou87 requested a review from tidy-dev August 5, 2021 14:25
Comment thread app/src/lib/ssh/ssh.ts
return false
}

return await fse.pathExists(WindowsOpenSSHPath)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For some reason this is true on Windows 11 for ARM, but later git can't find it 🤔

Comment thread app/src/lib/stores/app-store.ts Outdated
Comment on lines +490 to +494
// If the user never selected whether to use Windows OpenSSH or not, use it
// by default if we have to show the welcome flow (i.e. if it's a new install)
if (__WIN32__ && getBoolean(UseWindowsOpenSSHKey) === undefined) {
this._setUseWindowsOpenSSH(this.showWelcomeFlow)
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is what I used to check whether it's a first install or not: whether the welcome flow has been shown or not. If there is no stored value for this setting, set it to true only if we still have to show the welcome flow (i.e. if it's the first time the user opens the app).

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review please

@sergiou87
sergiou87 marked this pull request as draft August 9, 2021 11:03
@sergiou87

sergiou87 commented Aug 9, 2021 •

Copy link
Copy Markdown
Member Author

Just found some issues, I'll try another approach…

@sergiou87

Copy link
Copy Markdown
Member Author

Hopefully should be good now. I noticed some issues with the persisted setting not being read when the app starts 🤦‍♂️

I also noticed there is a GIT_SSH_COMMAND env variable that we can use instead of core.sshCommand, which should keep our logs cleaner. On the other hand, our logs won't tell us when git is using a custom ssh set by us, not sure if we should worry much at this point…

@sergiou87
sergiou87 marked this pull request as ready for review August 9, 2021 12:00

@tidy-dev tidy-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✨ Looks good and tested well.

(Definitely doesn't show up in mac. 😄 I tried there first without thinking about it being windows only 🤦 )

@sergiou87
sergiou87 merged commit a68c4f0 into development Aug 11, 2021
@sergiou87
sergiou87 deleted the windows-openssh branch August 11, 2021 08:29
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.

Desktop does not use OpenSSH on Windows if running, favours embedded SSH

2 participants