A quick google says that the folder should be located at /usr/share/git-core
but I think this differs depending on the way it was installed since mine is located at /usr/local/share/git-core
and my colleague's is somewhere else.
Is there a command or variable available to output the absolute location of git-core
?
$ git --exec-path
/usr/lib/git-core
Overridable via an argument to that flag or with GIT_EXEC_PATH environment variable.
If you have multiple copies of git, then try ~/homebrew/bin/git
or /usr/bin/git
or whatever the path to Xcode's copy is.
The full story of how git finds subcommands is actually straightforward: It finds the value of exec_path -- either from argv, the environment, or the compile-time value. Then it pushes this onto the front of PATH.
/*
* We use PATH to find git commands, but we prepend some higher
* precedence paths: the "--exec-path" option, the GIT_EXEC_PATH
* environment, and the $(gitexecdir) from the Makefile at build
* time.
*/
setup_path();
(Contrary to what this comment implies, it just picks one of those.)
Much older versions of git just polluted your path with all the git-whatever commands.
If you're trying to diagnose or bandage something funky, you could try manipulating PATH with whatever the correct path to git-core is, but it's much more likely that invoking the correct copy of git will work.
$ echo '/usr/bin/env' > ~/local/bin/git-env
$ chmod +x ~/local/bin/git-env
$ env - PATH=~/local/bin /usr/bin/git env
PATH=/usr/lib/git-core:/home/josh/local/bin
PWD=/home/josh
$
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