Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Git for Windows keeps asking for Github credentials

Tags:

git

windows

I always clone private Github repos via HTTPS. I have personal access token to use as "password" when git asked for it for the first time.

For a very long time, I was able to do git operations without git asking for credentials for every single command when I run things in command line.

But these days it always ask for credentials in command line!

I have tried various combinations for changing git config credentials.helper (changing to store/wincred/manager/cache) and a bunch of other things, nothing works.

Funny thing is, if I run git command inside VSCode terminal, then it will not ask for credentials and just work. But I do not want to have to fire up VSCode every time I need to do some git stuffs (especially when my computer is running low on RAM due to other tasks)

I need a permanent way to fix this issue while still using HTTPS remote url + personal access token

I am using Git for Windows git version 2.40.0.windows.1

My current horrible .gitconfig after trying many online guides

[credential "github.com"]
    authority = Github
    interactive = never
    preserve = true
[credential]
    helper = manager
    modalPrompt = true
    writelog = true
like image 815
John London Avatar asked Jan 28 '26 21:01

John London


1 Answers

I finally found the root cause

Apparently it is because git-credential-manager.exe is not found in PATH

Once I do set PATH=C:\Git\mingw64\bin;%PATH% and do one git push, I am prompted with web browser Github login, and then things just work now

like image 144
John London Avatar answered Jan 30 '26 09:01

John London



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!