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

Git Checkout Failed during clone or reset when there is illegal character from remote #2849

Closed
1 task done
kaovilai opened this issue Oct 15, 2020 · 2 comments
Closed
1 task done

Comments

@kaovilai
Copy link

kaovilai commented Oct 15, 2020

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.28.0.windows.1
cpu: x86_64
built from commit: 77982caf269b7ee713a76da2bcf260c34d3bf7a7
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.19041.508]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Editor Option: VisualStudioCode
Custom Editor Path:
Path Option: CmdTools
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Enabled
Enable Pseudo Console Support: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

    • Nope.. but to create this bug requires that another system (ie, WSL2 Ubuntu 20.04) not having same characters as illegal characters be the ones adding files to the remote prior to cloning/reset

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Powershell

Minimal

git clone https://github.com/kaovilai/gitFW-checkout-failed-issue-urlfolder/
  • What did you expect to occur after running these commands?

    • Successful clone of remote repository or explanation about illegal characters
  • What actually happened instead?

    • Checkout failed
  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

@dscho
Copy link
Member

dscho commented Oct 15, 2020

This is actually a known issue, and there have been valuable discussions around it already. In the most recent report, I wrote up a detailed analysis/project plan: #2803 (comment)

It might make sense to continue our discussion in that ticket; To that end, I will mark this here ticket as a duplicate.

https/wikipedia.com was commited from a Windows machine.

This sounds as if you had created that not necessarily just on "a Windows machine", but either using Cygwin's or MSYS2's shell tools. Cygwin (and by extension, the MSYS executables in MSYS2) use a trick to work around illegal file name characters: they are mapped into a private Unicode page, and that's what you are seeing here. Neither WSL nor regular Win32 tools (such as git.exe) know that they are expected to map those characters back to ASCII.

@kaovilai
Copy link
Author

kaovilai commented Oct 15, 2020

https/wikipedia.com was commited from a Windows machine.

This sounds as if you had created that not necessarily just on "a Windows machine", but either using Cygwin's or MSYS2's shell

Nope.. I just cloned the repo from WSL Ubuntu and the resulting folder (shared between two systems via WSL) in Windows is committed and pushed. I have not installed cygwin or msys myself unless its something WSL does in the backend regarding files.

So.. running the curl on ubuntu
git add *, commit and push from Windows creates https://github.com/kaovilai/gitFW-checkout-failed-issue-urlfolder/tree/main/https%EF%80%BA/wikipedia.com
pull and git add * commit and push from Ubuntu creates https://github.com/kaovilai/gitFW-checkout-failed-issue-urlfolder/tree/main/https:/wikipedia.com
I was able to still add from ubuntu because whatever was pushed from Windows is different (and invisible to Ubuntu??)

openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Aug 9, 2021
* Update puppet-keystone from branch 'master'
  to 4d17fb5dfb39b9f0f78635ce7560ee5900d9ab8a
  - Merge "Remove a file which causes cloning on Windows platform to fail"
  - Remove a file which causes cloning on Windows platform to fail
    
    There is a known issue with git-for-windows and currently clone and
    pull fail with invalid path errors if the target repository has any
    filename containing a character prohibited in Windows. We can find
    below examples reporting that issue.
     git-for-windows/git#2777
     git-for-windows/git#2803
     git-for-windows/git#2849
    
    Because it is unlikely that the issue is solved in git-for-windows
    shortly, this change drops one release note file currently causing
    the failure, as a quick workaround. Note that we can't rename existing
    release note files because that would make notes appear in a wrong
    release, and this is why this change should remove that file.
    
    Change-Id: Ib3615761b366ed849177ae79d7d105ef8b839da4
openstack-mirroring pushed a commit to openstack/puppet-keystone that referenced this issue Aug 9, 2021
There is a known issue with git-for-windows and currently clone and
pull fail with invalid path errors if the target repository has any
filename containing a character prohibited in Windows. We can find
below examples reporting that issue.
 git-for-windows/git#2777
 git-for-windows/git#2803
 git-for-windows/git#2849

Because it is unlikely that the issue is solved in git-for-windows
shortly, this change drops one release note file currently causing
the failure, as a quick workaround. Note that we can't rename existing
release note files because that would make notes appear in a wrong
release, and this is why this change should remove that file.

Change-Id: Ib3615761b366ed849177ae79d7d105ef8b839da4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants