Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub credential helper conflicts with wincred credential helper

I must be able to execute Git commands in two contexts:

  1. Within posh-Git (and the GitHub for Windows UI)
  2. By double-clicking batch files in Windows Explorer (I have created a series of batch files that simplify Git usage for non-technical project participants)

Everything works perfectly except for push/pull operations, where there is a credential helper issue. With the default GitHub setup, which uses helper = !github –credentials in etc/.gitconfig, remote ops work fine for context 1 but not context 2 (it asks for credentials every time). If I add helper = wincred to user/.gitconfig, then context 1 works fine and context 2 works fine though it first complains:

github --credentials get: github: command not found
github --credentials store: github: command not found

(I assume it complains because it’s trying to use the GitHub helper but can’t in context 2) but then proceeds to execute the push:

Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 467 bytes | 0 bytes/s, done.
Total 5 (delta 1), reused 0 (delta 0)
...

I could live with the complaint, but the problem is that whenever GitHub for Windows is started, it removes helper = wincred from user/.gitconfig.

The question is this: can I either

  1. Get context 1 to use the wincred helper
  2. get the GitHub helper to work in context 2
  3. prevent GitHub for Windows from removing wincred (though this behavior is probably correct, since I don’t think you are supposed to have two credential helpers)
  4. install a different credentials helper that will work in both contexts
like image 241
Rob Oaks Avatar asked Oct 31 '14 19:10

Rob Oaks


People also ask

How do I fix my Git credentials?

To update your credentials, go to Control Panel -> Credential Manager -> Generic Credentials. Find the credentials related to your git account and edit them to use the updated passwords as per the image below: I hope this helps with your Git issues.

How do I fix Git always asking for credentials?

You can avoid being prompted for your password by configuring Git to cache your credentials for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.

How do I store multiple Git credentials in Windows?

Just prefix the origin path with your username and @, like so: [email protected]/repo/reporepo. git This allows the Windows credential manager to store multiple logins.


1 Answers

I had a similar issue and contacted GitHub support and got this reply:

What you're hitting is a configuration sanitizer which GitHub for Windows runs on startup. We've seen significant issues in the past with other Git clients adding invalid/bad configuration values into this file and giving users a bad experience - so we had to take steps to mitigate these issues.

This is opt-in, and you can bypass this by running the following command:

git config --global ghfw.disableverification true

This fixed my issue

like image 59
Jeff Moser Avatar answered Sep 28 '22 08:09

Jeff Moser