I've installed the wp-cli using Git-bash, created the relevant PATH variables.
I am now able type 'wp' into the Windows CMD and it works, but Git-bash doesn't recognize the command.
What must I do get this working with Git-bash, and why doesn't it work out of the box?
I run into the same issue. For example command "wp cli version" is working in cmd but not in cygwin.
Check following tutorial: https://deluxeblogtips.com/install-wp-cli-windows/
If you are using cygwin, you will need to create another wp file (without .bat) extension. Just name it wp with following content:
#!/usr/bin/env sh
dir=$(d=${0%[/\\]*}; cd "$d"; pwd)
# See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
# Cygwin paths start with /cygdrive/ which will break windows PHP,
# so we need to translate the dir path to windows format. However
# we could be using cygwin PHP which does not require this, so we
# test if the path to PHP starts with /cygdrive/ rather than /usr/bin
if [[ $(which php) == /cygdrive/* ]]; then
dir=$(cygpath -m $dir);
fi
fi
dir=$(echo $dir | sed 's/ /\ /g')
"${dir}/wp-cli.phar" "$@"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With