Docker-credential-desktop.exe executable file not found in $PATH using wsl2

On one hand, that indeed has saved my day.

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).

Thanks! This worked for me.

In 2024, It worked for me

thanks a million sir… worked like a charm

that is work for me. thanks very much! save a lot of time.

This solution worked my as well. Thanks!

Sorry for also being a part of the necro-replies, but this also fixed my issue.

thanks a lot ~~~~~~~~~~~~~~~

worked for me too! was not using sudo

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.

you’re goddam genius

This worked the magic for me too, thanks

That still works in 2025, fresh docker version 28.3.3

Amazing!!

Solution posted in Nov 2020 (thank you so much!) → Today is 2nd Sept 2025!!!

I was using sudo and this worked for me! Thank you!