Home > Mobile >  Git Credential Manager Won't Authenticate Me
Git Credential Manager Won't Authenticate Me

Time:12-04

I am running WSL2 and trying to get Git Credential Manager (GCM) set up so that I don't have to always copy-paste my Github Personal Access Token into my terminal. Once I added the credential manager I was unable to access my remote repositories, this is what my .gitconfig looks like:

  1 [user]
  1     email = [email protected]
  2     name = Name
  3 [credential]
  4     helper = /mnt/c/Program\\ Files/Git/mingw64/libexec/git-core/git-credential-wincred.exe

Now when I do a git pull on the remote repository Git is telling me that it cannot be found. It's not clear to me why GCM is blocking me now, but would you have any recommendations for next steps?

CodePudding user response:

git-credential-wincred.exe is the old legacy credential helper.

GCM is git-credential-manager-core.exe

helper = manager-core.exe

(it will be manager.exe with Git 2.39 )

Make sure your $PATH includes /mnt/c/Program Files/Git/mingw64/bin/

Then this would work (under a WSL2 bash session):

printf "host=github.com\nprotocol=https" | git-credential-manager-core.exe get
# or
printf "host=github.com\nprotocol=https" | git credential-manager-core.exe get
                                             ^^^

However, this would not:

printf "host=github.com\nprotocol=https" | git credential-manager-core get
                                                                     ^^^
fatal: 'credential-manager-core' appears to be a git command, 
       but we were not able to execute it. 
       Maybe git-credential-manager-core is broken?

CodePudding user response:

If you are using Git Credential Manager (GCM) to manage your Git credentials, it is likely that you are encountering an issue with the configuration of your Git settings. There are a few possible reasons why GCM might be preventing you from accessing your remote repositories. Here are a few possible solutions to try:

Make sure that you have installed GCM correctly and that it is running on your system. To do this, you can try running the git credential-manager version command in your terminal. If GCM is installed and running, you should see the version number displayed in the output.

Check the configuration of your Git settings to ensure that the path to GCM is correct. In your .gitconfig file, the helper value should be set to the path of the git-credential-manager.exe file on your system. For example, if GCM is installed in the C:\Program Files\Git\mingw64\libexec\git-core directory, the helper value should be set to /mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe.

If you are still unable to access your remote repositories, you may need to clear your Git credentials. To do this, you can try running the git credential-manager reject command in your terminal. This will remove any saved credentials from your system, allowing you to enter new ones the next time you access a remote repository.

I hope these suggestions help! If you are still having trouble getting GCM to work, it might be worth reaching out to the Git community for further support.

  • Related