Win32-OpenSSH
Win32-OpenSSH copied to clipboard
git clone always give error message,fatal: ''mongodb'' does not appear to be a git repository, with a wired double quotes
$ git clone ssh://[email protected]:mongodb Cloning into 'mongodb'... [email protected]'s password: fatal: ''mongodb'' does not appear to be a git repository ---------------this is the wrong output of git-upload pack, git clone will call the git-upload-pack in remote server fatal: Could not read from remote repository.
BUT I TRIED THIS ,IT WORKS
$ ssh [email protected] "git-upload-pack mongodb" [email protected]'s password: 0000----------------this is a right ouput is git-upload-pack
I found instead of single quotes of ''mongodb''in err msg ---fatal: ''mongodb'' does not appear to be a git repository---, gives a wired double quotes, and I tried in local the 'git-upload-pack' command, it only give single quote in its err msg.
I think something wrong when transferring the repo path to ssh remote server, shoud be caused by the openssh
Similar to https://github.com/PowerShell/Win32-OpenSSH/issues/389
Looks like if I do not mention any protocol, git is picking up ssh and cloning works fine.

But if ssh is mentioned as protocol it does not work. I tired it on Linux using openssh. So it might be issue related with git command itself.

The git documentation says ssh is supported though.

I am having a similar issue as the op.
I have a bare git repo in a test directory in my users (named git) homes folder.
I have ssh running using OpenSSH-Win64. When I run git clone on another windows pc I get a similar message
git clone git@server:test
(Separate issue here when using ssh url format instead of scp format that you can't use a relative path as it will put / in front of your path)
"fatal: ''test'' does not appear to be a git repository"
I upped the ssh logging and can see this is output:
Executing command: E:\\Tools\\OpenSSH-Win64\\ssh-shellhost.exe -nopty Z2l0LXVwbG9hZC1wYWNrICd0ZXN0Jw==
Decoding the Z2l0LXVwbG9hZC1wYWNrICd0ZXN0Jw== gives "git-upload-pack 'test'"
If I run that command locally I get the same error. However if I remove the single quote or replace them with double the command works.
I don't think it is possible to get windows command prompt to recognise single quotes as a quote character.
Suggestions:
Optionally use sh/powershell instead of cmd.exe. Maybe just default to powershell it's ok with single quotes.
GOTO_CLEANUP_ON_ERR(wcscat_s(cmd, MAX_CMD_LEN, L"cmd.exe"));
https://github.com/PowerShell/Win32-OpenSSH/blob/L1-Prod/contrib/win32/win32compat/shell-host.c line 978.
Replace single quotes with doubles prior to line 987
https://github.com/PowerShell/Win32-OpenSSH/blob/L1-Prod/contrib/win32/win32compat/shell-host.c line 987
Please try with the recent release (0.0.9.0).. I think this should be fixed..
I've checked and I am on that 0.0.9.0 version.
BTW is there an easy way of finding what version you are on. It's not on the downloaded artefact or in the ssh_config and there doesn't seems to be a readme in the output.
A
is it working on 0.0.9.0 version?
Thanks for the suggestion, we will add a way to find the version.
The issue I had above was with the 0.0.9.0 version.
A
We are having the same issue with the most up to date version...
Use this to retrieve product version: (get-item .\sshd.exe).VersionInfo.FileVersion
I am using 0.0.10.0 according to the command I just ran. Are there any current workarounds?
PS C> git clone user@serverA:Z:/gitrepo.git
Cloning into 'gitrepo.git'...
user@serverA's password:
fatal: ''Z:/gitrepo.git'' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
It appears I am also getting the double single quotes '' instead of "
This by far is the easier way to get around the double quote issue:
powershell New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\Git\bin\bash.exe" -PropertyType String -Force
This changes the default OpenSSH shell to bash.