Skip to content

shell-host.c does not interpret the single quoted file path #895

Open

Description

@bingbing8

Please answer the following

If it is a terminal issue then please go through wiki
https://github.com/PowerShell/Win32-OpenSSH/wiki/TTY-PTY-support-in-Windows-OpenSSH

"OpenSSH for Windows" version
0.0.20.0

Server OperatingSystem
win10

Client OperatingSystem
Win10

What is failing
shell-host.c passes through to cmd.exe, single quotes as literals. The literal single quotes become part of the file path name, resulting in an incorrect file path.

Expected output
shell-host.c should interpret the single quoted file path correctly
Actual output

Activity

  1. bingbing8 commented on Sep 29, 2017

    @bingbing8
    ContributorAuthor
  2. diogocp commented on Nov 13, 2017

    @diogocp

    It looks like the same thing happens if you set PowerShell as the default shell in the registry, so it's not just a problem with cmd.exe.

  3. amir3code commented on Aug 16, 2018

    @amir3code

    Windows and specially powershell really really suck hard.
    I dont have an ubuntu vps right now and If I had I would definietly switch back to my developement for linux environments.
    Setting up a git server is way easy on linux than it is on windows
    And I dont get it, Why windows is famous for its simplicity while it is just a bunch of unwell written binaries?

  4. doggy8088 commented on Oct 12, 2018

    @doggy8088

    Yanbing (@bingbing8) Is there any progress on this issue?

  5. bingbing8 commented on Oct 14, 2018

    @bingbing8
    ContributorAuthor

    Will 保哥 (@doggy8088) we are working #1082, #1211, and this one together to escape double quotes in a central place. It is in progress.

  6. bingbing8 commented on Oct 16, 2018

    @bingbing8
    ContributorAuthor

    Will 保哥 (@doggy8088), do you have a repro command for me to validate the change?

  7. doggy8088 commented on Oct 16, 2018

    @doggy8088

    Yanbing (@bingbing8) Just simply git clone [email protected]:c:/123.git

  8. bingbing8 commented on Oct 17, 2018

    @bingbing8
    ContributorAuthor

    Will 保哥 (@doggy8088), I tried with powershell as default shell, it works fine

    PS D:\git> git clone domain\user@serverhost:F:\git\testsource.git
    Cloning into 'testsource'...
    warning: You appear to have cloned an empty repository.
    
    

    The reason it does not work when the default shell is cmd is that cmd does not consume the single quotes, it simply pass to the executable. if you run this locally in your cmd prompt, it also failed.

    C:\WINDOWS\system32>git-upload-pack 'F:\\git\\testsource.git'
    fatal: ''F:\\git\\testsource.git'' does not appear to be a git repository
    
  9. dmitry-cherkas commented on Jan 5, 2019

    @dmitry-cherkas

    Hi Yanbing (@bingbing8),

    I'm trying to clone a Git repo from the server, which I set up with OpenSSH on Windows (OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4), but I'm facing same issue as described in this thread:

    C:\Users\cherk>git clone [email protected]:C:/Users/git/ib/web-app.git
    Cloning into 'web-app'...
    fatal: ''C:/Users/git/ib/web-app.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
    and the repository exists.
    

    I've checked a number of related threads (#752, #1237) and for some reason setting powershell as default Shell does not resolve the issue for me. At the same time, the workaround, described here works fine, so I'm assuming it's not permissions, or bad URL issue. Unfortunately, the mentioned workaround is not acceptable for me, as it requires configuration to be done by each client, so I'm really hoping to sort things out with powershell used as a default shell.

    I'm happy to provide additional details for troubleshooting, please let me know which details/log files would help identify the root cause?

  10. trenst commented on Jan 17, 2019

    @trenst

    I've got the same comment as Dmitry Cherkas (@dmitry-cherkas) and I'm running the same version of openssh. Setting the DefaultShell of the openSSH HKLM to powershell does not work. Only the workaround shown here permitted me access to my git repository.

  11. X9VoiD commented on Aug 26, 2022

    @X9VoiD

    This is still happening to this day. git clone still hangs due to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions