git-ecosystem / git-ecosystem/git-credential-manager

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

Open
#1,601 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
9.3k
Forks
2.9k
Avg merge
7d 1h
Merged PRs (30d)
14

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GitCredentialManager.EnvironmentBase.TryLocateExecutable call shown in the stack trace and reproduce the failure with the described invalid Windows PATH during git clone. Improve the resulting error handling or message so the invalid PATH characters are identified, then verify cloning no longer produces an unhandled exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.