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

Latest standalone GCM installation "fails" on Windows due to hard dependency on git.exe #770

Open
ashemedai opened this issue Jun 30, 2022 · 7 comments
Labels
bug A bug in Git Credential Manager

Comments

@ashemedai
Copy link

ashemedai commented Jun 30, 2022

Trying to install (or uninstall) gcmcore-win-x86-2.0.696.exe on Windows 10 (21H1) "fails". You get this popup and wonder what is going wrong:

image

All the files do get installed correctly into C:\Program Files (x86)\Git Credential Manager. Running git-credential-manager-core.exe from that directory gives the following:

image

This flies against what is documented at https://github.com/GitCredentialManager/git-credential-manager/blob/main/docs/wsl.md#configuring-wsl-without-git-for-windows since it seems to want to be able to find a git.exe. So somewhere some hardcoded dependency on git.exe has been added.

Edit: the same problem exists in gcm-win-x86-2.0.779.exe as well.

Edit2: Last known working version: gcmcore-win-x86-2.0.194.40577.exe. Started giving the above problems with gcmcore-win-x86-2.0.246.34937.exe

Edit3: Checking a comparison points me to this as the most obvious culprit (after adjusting for refactors): https://github.com/GitCredentialManager/git-credential-manager/blob/d6834d682396bfed06bebbc16cedfe4a25d00400/src/shared/Core/CommandContext.cs#L150-L180

@ashemedai ashemedai changed the title Latest standalone GCM installation fails on Windows due to hard dependency on git.exe Latest standalone GCM installation "fails" on Windows due to hard dependency on git.exe Jun 30, 2022
@ldennington
Copy link
Contributor

GCM integrates with Git as a credential helper. Without a Git installation, GCM cannot function properly. Can you point me to the specific section of the WSL docs that specifies no Git installation is required? Also, are you trying to configure WSL or just install GCM for Windows? If the latter, is there a reason you're not installing Git for Windows (which automatically installs and configures GCM for you)?

@ashemedai
Copy link
Author

@ldennington That link was already in my original message. For completeness sake, let me quote from https://github.com/GitCredentialManager/git-credential-manager/blob/main/docs/wsl.md#configuring-wsl-without-git-for-windows:

If you wish to use GCM inside of WSL without installing Git for Windows you must complete additional configuration so that GCM can callback to Git inside of your WSL installation.

The particular use case is transparent use of credentials from the Windows Credential Manager to git in WSL. This is a much friendlier user experience for people not versed in Linux, but who need to use WSL for projects via their Windows VS Code installation. (All credits to @mjcheetham for documenting this in the first place.)

So there is a git installation, it just happens to reside within WSL and is made accessible via WSL's GIT_EXEC_PATH/wp.

@ldennington
Copy link
Contributor

Just to confirm - the specific problem here is that the installer fails when you don't have a git executable on your Windows PATH because it lives inside WSL? @mjcheetham - heads up on this...is there a way to avoid calling git-credential-manager-core configure from the Inno Setup script in this scenario?

@ashemedai
Copy link
Author

@ldennington That is correct.

So this is what you would get with .696:
image

And since WSL in VS Code calls the WSL git, this works transparently.

@ivailop
Copy link

ivailop commented Jan 9, 2023

I encountered one more use case, independent of the GCM standalone installation.
If you install the Git for Windows and do not update the Windows system PATH (as you don't want to pollute the system) any use of GCM (from Windows terminal or WSL) would fail with:

Unhandled Exception: System.Exception: Failed to locate 'git.exe' executable on the path.
   at GitCredentialManager.EnvironmentExtensions.LocateExecutable(IEnvironment environment, String program)
   at GitCredentialManager.CommandContext.GetGitPath(IEnvironment environment, IFileSystem fileSystem, ITrace trace)
   at GitCredentialManager.CommandContext..ctor(String appPath, String installDir)
   at GitCredentialManager.Program.Main(String[] args)

Based on the implementation, git.exe is expected to be on the PATH

However on Windows, search of executable is the done different compared to Linux - the current directory is checked before the PATH.

In fact, "Git for Windows" places both git-credential-manager-core.exe and git.exe in the same directory
image

@ldennington
Copy link
Contributor

@ivailop - are you using Windows or WSL? I'm not sure this can be considered a separate use case for the same issue if the former.

@ivailop
Copy link

ivailop commented Jan 12, 2023

@ivailop - are you using Windows or WSL? I'm not sure this can be considered a separate use case for the same issue if the former.

I encountered the problem using WSL. While figuring out the issue, tried simply running:

  • in WSL console
/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe --version
  • and Windows cmd
"C:\Program Files\Git\mingw64\bin\git-credential-manager.exe" --version

And in both cases got the same error (as mentioned above)

@ldennington ldennington added the bug A bug in Git Credential Manager label Aug 28, 2023
@mjcheetham mjcheetham removed their assignment Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in Git Credential Manager
Projects
None yet
Development

No branches or pull requests

5 participants
@ashemedai @ivailop @mjcheetham @ldennington and others