4

Something I'm unable to track down the source of my broken my Git “subtree” command. I'm running Windows 2010 Pro.

Here the error message, instead of display the help info:

$ git subtree
It looks like either your git installation or your
git-subtree installation is broken.

Tips:
 - If `git --exec-path` does not print the correct path to
   your git install directory, then set the GIT_EXEC_PATH
   environment variable to the correct directory.
 - Make sure that your `git-core\git-subtree` file is either in your
   PATH or in your git exec path (`C:/Program Files/Git/mingw64/libexec/git-core`).
 - You should run git-subtree as `git core\git-subtree`,
   not as `git-core\git-subtree`

This the output of --exec-path option:

$ git --exec-path
C:/Program Files/Git/mingw64/libexec/git-core

No matter if I set the path C:/Program Files/Git/mingw64/libexec/git-core in PATH and/or GIT_EXEC_PATH env variable, no matter if I do it in Git Bash .bashrc I always get the same error message.

I tried to removed and install it again various time achieving nothing.

I tried to examine git-subtree script source, this is the code that detects the issue:

if test -z "$GIT_EXEC_PATH" || test "${PATH#"${GIT_EXEC_PATH}:"}" = "$PATH" || ! test -f "$GIT_EXEC_PATH/git-sh-setup"
then
    echo >&2 'It looks like either your git installation or your'
    echo >&2 'git-subtree installation is broken.'
    echo >&2
    echo >&2 "Tips:"
    echo >&2 " - If \`git --exec-path\` does not print the correct path to"
    echo >&2 "   your git install directory, then set the GIT_EXEC_PATH"
    echo >&2 "   environment variable to the correct directory."
    echo >&2 " - Make sure that your \`${0##*/}\` file is either in your"
    echo >&2 "   PATH or in your git exec path (\`$(git --exec-path)\`)."
    echo >&2 " - You should run git-subtree as \`git ${0##*/git-}\`,"
    echo >&2 "   not as \`${0##*/}\`." >&2
    exit 126
fi

I don't know why at least one condition is not satifisfied, why in my opinion should.

I have also made a test. If I comment the guard code about paths everything work perfectly.

1
  • I've done a test. If I comment the guard code about paths everything works perfectly.
    – gsscoder
    Commented Jun 16, 2021 at 4:07

2 Answers 2

2

It appears to be a bug in [email protected] for Windows. You can check the issue here

It looks like either your git installation or your git-subtree installation is broken.

Tips:

  • If git --exec-path does not print the correct path to your git install directory, then set the GIT_EXEC_PATH environment variable to the correct directory.
  • Make sure that your git-core\git-subtree file is either in your PATH or in your git exec path (C:/Program Files/Git/mingw64/libexec/git-core).
  • You should run git-subtree as git core\git-subtree, not as git-core\git-subtree.

For now, you can downgrade to @2.31, e.g.: https://github.com/git-for-windows/git/releases/download/v2.31.0.windows.1/Git-2.31.0-64-bit.exe

2
  • I have quoted the relevant information from your link, in the future, it would be appreciated if you did that yourself.
    – Ramhound
    Commented Jul 7, 2021 at 9:50
  • @Ramhound, okay, thank you! Commented Jul 7, 2021 at 9:57
1

This bug was fixed in the newer version v2.32.0.windows.2.

I had the same issue and a simple reinstall of the latest Git for Windows fixed it.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .