On the other hand, I’m somewhat sure that this doesn’t actually fix the problem but rather sweeps it under the rug as one of the other users pointed out.
I would love to help someone investigate the original problem deeper, feel free to hit me up on Github (just write a comment in any repo of mine: @cognivore).
I had this problem too, and even though this is an old post, it’s still a top Google search result so I’ll share my solution.
I’m on Windows 11. My docker-credential-desktop.exe is located in this folder, which I believe is the default install location: C:\Program Files\Docker\Docker\resources\bin
This folder was part of my Windows $PATH environment variable but Git Bash could not locate it. For me it was because some of the paths in the variable contain spaces (specifically the “Program Files” folder).
To fix it, I tried surrounding just that folder with quotation marks in the $PATH variable. This did not work. I had to surround EVERY folder in $PATH with quotation marks. Then I had to RESTART Git Bash.
Using the Windows UI:
Bring up the power user menu: Windows Key + X
Select “System”
Click on “Advanced System Settings” link (roughly 1/3 the way down the System dialog, about center screen)
Click the Environment Variables button
Highlight the variable named “Path” and click Edit
Click the “Edit text” button (NOT the “Edit” button – “Edit text” will let you edit the entire path variable at once)
Copy the string into a text editor like Notepad
Surround each of the paths, which are separated by semicolons, with double-quotation marks
i.e.: "path 1";"path 2";"path 3"
Copy the edited string back into the Edit text dialog and click OK
Restart Git Bash
Warning: any programs or installations that edit your $PATH automatically might undo this change. For example, I installed pnpm and it removed all the quotation marks I had put in and I had to manually re-insert them.
I don’t know if there’s a more elegant fix for the problem but this I the best I’ve found so far.