Unable to execute git tf command

2.9k views Asked by At

I just setup git-tf, but I'm running into an issue.

Here's the error I'm receiving:

> git tf help
line 23: exec: cmd: not found
fatal: 'tf' appears to be a git command, but we were not
able to execute it. Maybe git-tf is broken?

Here is a screenshot of the command prompt:

git-tf error

I followed the instructions for installation that appear in the included Git-TF_GettingStarted.html file, but I can't seem to get this to work. What have I done wrong?

Edit I also have cygwin installed and on my PATH. Maybe this is causing confusion for git-tf? (Removing cygwin from PATH does nothing to help)

3

There are 3 answers

1
Edward Thomson On BEST ANSWER

This looks like a bug in the git-tf sh script on Windows, where we assume that %WINDIR% is in your path when we should be providing a full path to cmd.exe when we try to launch it.

Until we've released a fix for this, you can do one of two things:

  1. Add %WINDIR%\system32 to your path.

  2. Edit git-tf and change line 23. Instead of simply exec'ing cmd, the appropriate line (in mingw32) should be:

    exec "$WINDIR/system32/cmd.exe" //C "$0.cmd" "$@"
    
0
Jichao On

The "\" in %COMSPEC% will mess up with "git tf" under windows cmdline or mingw32

if [ "$PLATFORM" = "cygwin" ]; then
    COMSPEC_U=`cygpath -u "$COMSPEC"`
    GITTF_CMD=`cygpath -w "$0.cmd"`
    exec "$COMSPEC_U" /C "$GITTF_CMD" "$@"
elif [ "$PLATFORM" = "mingw32" ]; then
#   exec "$COMSPEC" //C git-tf.cmd "$@"
    exec "C:/WINDOWS/system32/cmd.exe" //C git-tf.cmd "$@"
fi
1
jrk On

I don't know if it's the version of Cygwin I have installed or what but I just ran into this same problem and the above solution did not work. The problem was with the $0 substitution having a unix style path and cmd.exe choked on it.

In order to fix it, I changed this line:

exec $COMSPEC //C "$0.cmd" "$@"

to this:

exec $(cygpath $COMSPEC) /C $(cygpath --windows "$0.cmd") "$@"

That might only work for Cygwin. I never used MinGW32 and I'm not sure if its cygpath utility does exactly the same thing.