find is always a complete mystery to me whenever I use it; I just want to exclude everything under /mnt (I am in bash on Ubuntu 20.04 on WSL so don't want it to search in the Windows space) from my search, but find just blunders into those directories completely ignoring me. I found syntax from this page. https://stackoverflow.com/questions/4210042/how-to-exclude-a-directory-in-find-command and tried all variations - all failed.
sudo find / -name 'git-credential-manager*' -not -path '/mnt/*'
sudo find / -name 'git-credential-manager*' ! -path '/mnt/*'
sudo find / -name 'git-credential-manager*' ! -path '*/mnt/*'
When I do this, it just blunders into /mnt and throws errors (which is really frustrating as the syntax above looks clear, and the stackoverflow page syntax seems correct):
find: ‘/mnt/d/$RECYCLE.BIN/New folder’: Permission denied
find: ‘/mnt/d/$RECYCLE.BIN/S-1-5-18’: Permission denied
Can someone show me how to stop find from ignoring my directory exclusion switches?