Skip to content

Ubuntu 20.04 on WSL for Windows 11 gives error on git clone if Windows %PATH% has special/invalid characters  #1601

Description

@bartpinto

Ubuntu 20.04 on WSL for Windows 11 gives error on git clone if Windows %PATH% has special/invalid characters

git version 2.43.2
Linux DESKTOP-0PHQ4UG 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"

Invalid PATH entry (CRLF):
C:\Program Files (x86)\Microsoft Visual
Studio\2019\BuildTools\MSBuild\Current\Bin

Relevant gitconfig:
[credential]
helper = /mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe
azreposCredentialType = oauth
msauthUseBroker = true
msauthUseDefaultAccount = true
[credential "https://dev.azure.com"]
useHttpPath = true
[safe]
directory = *
[credential "azrepos:org/msazuredev"]
azureAuthority = https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47

Error message:
Cloning into 'nc-labs'...

Unhandled Exception: System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.Combine(String path1, String path2)
at GitCredentialManager.EnvironmentBase.TryLocateExecutable(String program, ICollection`1 pathsToIgnore, String& path)
at GitCredentialManager.EnvironmentBase.TryLocateExecutable(String program, String& path)
at GitCredentialManager.EnvironmentExtensions.LocateExecutable(IEnvironment environment, String program)
at GitCredentialManager.CommandContext.GetGitPath(IEnvironment environment, IFileSystem fileSystem, ITrace trace)
at GitCredentialManager.CommandContext..ctor()
at GitCredentialManager.Program.AppMain(Object o)
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart(Object obj)

Expected Result:
Improve error handling or messaging, "Check your Windows %PATH% for invalid "<", ">", "|" or special characters."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions