I'm receiving the below error when attempting to do anything with Git over SSH on a non-standard port, and was wondering if anyone could help solve the issue.
git -c diff.mnemonicprefix=false -c core.quotepath=false fetch --prune origin
plink: unknown option "-p"
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Completed with errors, see above.
Environment
Windows 10 Pro 64 bit
Sourcetree 2.5.4 (Windows)
Git 2.16.1 (System)
Git 2.15.1 (Embedded)
plink 0.70.2 (Embedded)
Putty/plink 0.70.0 (System)
TortoiseGit 2.6.0
Other Details
I fixed this by going to Options=>General under the SSHClient configuration section, there is a dropdown for SSHClient.
I chose OpenSSH instead of "Putty / Plink". You may have to install openssh on your machine before you see this option in your dropdown. That fixed it for me.
OpenSSH is picked up from the Git client, it should always be available.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
As far as I can see the only time we make use of the -P option is if there is an interaction with the remote that triggers a response indicating the server's host key is not cached or has changed.
We then re-run plink.exe with the -P option if required, but that should be uppercase.
If this is the case you should have been prompted by Sourcetree to accept the new SSH key, did this happen?
You can find out a bit more about what might be happening be enabling DEBUG logging, by changing ERROR to DEBUG in %localappdata%/Sourcetree/app-2.5.4/log4net.config
This will log to %localappdata%/Atlassian/Sourcetree/sourcetree.log you should be able to find any plink.exe calls with associated arguments in there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't recall Sourcetree initially asking to accept the SSH key, but maybe that has something to do with possibly accepting it via TortoiseGit previously?.
I did attempt to completely remove Sourcetree and re-install it to try again. It did not prompt for accepting the SSH Key. If you can provide an idea of where/how to clear out cached keys I can attempt to do that.
On a recent attempt I accidentally misspelled the repo name in the URL (but everything else was correct), Sourcetree did prompt to accept the SSH key. This ultimately failed though because my repo name was incorrect. After correcting the spelling, it functioned as previously with the same output.
I made the log4net config change and did see a lot more output into sourcetree.log, but nothing that stood out or seemed to provide anymore info in relation to the error.
The command that Sourcetree is saying it's attempting to run (above), I attempted to run that manually in both Git Bash and PowerShell and got the exact same error in response
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just updated (System) Git to 2.16.2 (from 2.16.1) and it seems to have fixed the issue for Git when used from PowerShell or Git Bash, but issue remains with Sourcetree regardless of using System or Embedded Git.
Workaround found:
I have just managed to find a workaround for the issue by replacing SourceTree/app-*/tools/plink.exe with TortoiseGitPlink.exe (renamed to plink.exe). It should be noted that I tried to do the same by using Putty's plink.exe, but this did not work and resulted in the same issue.
This also explains the above where re-installing Git fixed the issue for Git via shell, because Git via shell looks at the GIT_SSH environment variable, which pointed to TortoiseGItPlink.exe when it was detected during re-installation of Git, meaning Git was using TortoiseGitPlink.exe and working.
SourceTree obviously does not use GIT_SSH environment variables, and prefers it's own plink.exe which for whatever reason I am having an issue with.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the detailed response. We will add it to our backlog to investigate.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That helped! Thank you sir.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I fixed this by going to Options->General under the SSHClient configuration section, there is a dropdown for SSHClient. I chose OpenSSH instead of Putty / Plink. You may have to install openssh on your machine before you see this option in your dropdown. That fixed it for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
FYI I seem to recently be having the same issue on another dev system. The suggested workaround above still worked (replacing plink.exe)
I've replaced it with that found in TortoiseGit, which is (plink) version 0.70.0 . The version in SourceTree is 0.70.2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this problem again. Yesterday in an attempt to fix a different issue with the push dialog I updated Git for Windows to 2.26.0 and installed Embeded Git 2.24.1. Now today this issue has shown up again.
For SourceTree 3.3.8 I found that switching between Embedded Git or System Git, SourceTree will use the same SourceTree plink 0.70.2 and pageant 0.70.2. It will succeed in fetching when using Embedded Git but will fail when using System Git.
If I manually run Putty pageant 0.73 instead, SourceTree will succeed/fail in the exact same way when switching between Embedded/System Git.
If I replace SourceTree plink with Putty plink 0.73, Sourcetree will succeed/fail in the exact same way when switching between Embeeded/System Git.
If I replace SourceTree plink with TortoiseGit plink 0.73, SourceTree will succeed in both cases regardless of Embedded/System Git.
So solutions so far seem to be:
I look forward to resolving this issue again next year ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this problem again. Yesterday in an attempt to fix a different issue with the push dialog I updated Git for Windows to 2.26.0 and installed Embeded Git 2.24.1. Now today this issue has shown up again.
What I suspect has happened is that by installing Embedded Git, it has replaced SourceTree's embedded plink.exe, which I have previously had issues with.
For SourceTree 3.3.8 I found that switching between Embedded Git or System Git, SourceTree will use the same SourceTree plink 0.70.2 and pageant 0.70.2. It will succeed in fetching when using Embedded Git but will fail when using System Git.
If I manually run Putty pageant 0.73 instead, SourceTree will succeed/fail in the exact same way when switching between Embedded/System Git.
If I replace SourceTree plink with Putty plink 0.73, Sourcetree will succeed/fail in the exact same way when switching between Embeeded/System Git.
If I replace SourceTree plink with TortoiseGit plink 0.73, SourceTree will succeed in both cases regardless of Embedded/System Git.
So solutions so far seem to be:
I look forward to resolving this issue again next year ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.