Fix Git install check

When the target command is not found, `which` does following action:
- on CentOS: output result like "no <command name>" to stderr and exit with 1
- on Ubuntu: does not output anything and exit with 1

So we should check status code of `which` command to check
whether the target command is in $PATH or not.