Win32-OpenSSH icon indicating copy to clipboard operation
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

Open tbxy09 opened this issue 9 years ago • 12 comments
trafficstars

$ 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

tbxy09 avatar Nov 09 '16 08:11 tbxy09

Similar to https://github.com/PowerShell/Win32-OpenSSH/issues/389

arif-pragmasys avatar Dec 05 '16 20:12 arif-pragmasys

Looks like if I do not mention any protocol, git is picking up ssh and cloning works fine. image

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. image

The git documentation says ssh is supported though.

image

arif-pragmasys avatar Dec 05 '16 21:12 arif-pragmasys

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

Aigeec avatar Feb 23 '17 23:02 Aigeec

Please try with the recent release (0.0.9.0).. I think this should be fixed..

bagajjal avatar Feb 24 '17 00:02 bagajjal

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

Aigeec avatar Feb 24 '17 20:02 Aigeec

is it working on 0.0.9.0 version?

Thanks for the suggestion, we will add a way to find the version.

bagajjal avatar Feb 24 '17 21:02 bagajjal

The issue I had above was with the 0.0.9.0 version.

A

Aigeec avatar Feb 24 '17 21:02 Aigeec

We are having the same issue with the most up to date version...

asinno avatar Mar 22 '17 17:03 asinno

Use this to retrieve product version: (get-item .\sshd.exe).VersionInfo.FileVersion

manojampalam avatar Mar 22 '17 20:03 manojampalam

I am using 0.0.10.0 according to the command I just ran. Are there any current workarounds?

asinno avatar Mar 22 '17 20:03 asinno

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 "

asinno avatar Mar 22 '17 20:03 asinno

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.

naloqab avatar Apr 15 '19 21:04 naloqab