Ah....
Never mind! I think I figured it out.
I find this post: Can I commit files from Git from KM? - Questions & Suggestions - Keyboard Maestro Discourse
So I added
export PATH=/usr/local/bin:$PATH;
at the beginning of the script, and it now works!