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

ignore quotes in core.sshCommand warning #24

Open
adamralph opened this issue Feb 29, 2020 · 4 comments
Open

ignore quotes in core.sshCommand warning #24

adamralph opened this issue Feb 29, 2020 · 4 comments
Milestone

Comments

@adamralph
Copy link

adamralph commented Feb 29, 2020

System Details

  • posh-sshell version/path: 0.3.1 ~\Documents\PowerShell\Modules\posh-sshell\0.3.1
  • PowerShell version: 6.2.4
  • OS: Microsoft Windows NT 10.0.18363.0

Issue Description

WARNING: core.sshCommand in your .gitconfig is set to "C:/Windows/System32/OpenSSH/ssh.exe", but it should be set to C:/WINDOWS/System32/OpenSSH/ssh.exe.

The quotes are redundant, since the path contains no spaces, but they should be ignored.

@JeremySkinner
Copy link
Collaborator

Hi, it isn't actually the case that this is complaining about - it's already doing a case-insensitive comparison (powershell string comparisons are case insensitive by default). It's actually creating the warning because of the quotes.

I think you should be able to just remove the quotes around the path and the warning will go away (you don't need them unless the path contains spaces), but I can also look at making the check more robust so it ignores the quotes for a future version (or if you wanted to submit a pull request to do this, that would be welcome too).

@JeremySkinner JeremySkinner added this to the 0.4 milestone Feb 29, 2020
@adamralph
Copy link
Author

Ah, I see, thanks. I'll alter the title and description.

@adamralph adamralph changed the title core.sshCommand warning is case sensitive ignore quotes in core.sshCommand warning Feb 29, 2020
@darthstark1138
Copy link

darthstark1138 commented Jun 25, 2020

Removing the quotes is an option if you don't have spaces, but not if you do have them.
WARNING: core.sshCommand in your .gitconfig is set to 'C:/Program Files/OpenSSH-Win64/ssh.exe', but it should be set to C:/Program Files/OpenSSH-Win64/ssh.exe.
That is the default Chocolatey install location for OpenSSH btw.

Edit to add: I've tested and my Git (git for windows, 2.27.0.windows.1) doesn't consider double-quoted paths on any config files.

With
[core] sshCommand = "C:/Program Files/OpenSSH-Win64/ssh.exe"
I get
> git pull C:/Program Files/OpenSSH-Win64/ssh.exe: C:/Program: No such file or directory fatal: Could not read from remote repository.

With
[core] sshCommand = 'C:/Program Files/OpenSSH-Win64/ssh.exe'
I get
WARNING: core.sshCommand in your .gitconfig is set to 'C:/Program Files/OpenSSH-Win64/ssh.exe', but it should be set to C:/Program Files/OpenSSH-Win64/ssh.exe.

With other combinations, I get
fatal: bad config line 35 in file C:/Users/mvhec/.gitconfig

Anyway, I'm issuing a pull request to ignore single-quoted paths.

@nemchik
Copy link

nemchik commented Jun 21, 2022

I just installed posh-sshell and added Start-SshAgent -Quiet to my Powershell profile and it seems to have added the core.sshCommand configuration to my C:\Users\me\.gitconfig file as

[core]
	sshCommand = C:/Program Files/OpenSSH/ssh.exe

which causes errors when using git, saying:

C:/Program Files/OpenSSH/ssh.exe: C:/Program: No such file or directory

wrapping the value in .gitconfig in single quotes is the only way I've found to make things work, but then every time I open a shell I get

WARNING: core.sshCommand in your .gitconfig is set to 'C:/Program Files/OpenSSH/ssh.exe', but it should be set to C:/Program Files/OpenSSH/ssh.exe.

It seems like this value isn't needed at all. If I remove Start-SshAgent -Quiet from my Powershell profile and remove the core.sshCommand configuration from my .gitconfig everything works fine, and the configuration is not automatically re-added.

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

4 participants