Ovi*_*vid 13 git macos osx-snow-leopard
我最近将我的MacBook Pro升级为Snow Leopard并且"git pull"返回:
rakudo $ git pull
git: 'pull' is not a git-command. See 'git --help'
Did you mean this?
        shell
rakudo $ git-pull
-bash: git-pull: command not found
我试过通过macports重新安装,但无济于事.然后我看到了这个
rakudo $ git --exec-path
/Users/ovid/libexec/git-core
这令我感到惊讶,因为该目录不存在,也不存在.谷歌没有帮助.希望你能:)
Dom*_*ell 24
查看git的源代码,git.c中有一条注释:
/*
 * 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.
 */
如果你打电话git --exec-path,你最终会调用const char *git_exec_path(void)在exec_cmd.c.看起来像这样:
const char *env;
if (argv_exec_path)
    return argv_exec_path;
env = getenv(EXEC_PATH_ENVIRONMENT);
if (env && *env) {
    return env;
}
return system_path(GIT_EXEC_PATH);
现在,_argv_exec_path_设置为当你说--exec-path=/some/where这样可以打折.您已声明未设置环境变量.  GIT_EXEC_PATH在Makefile中编译时定义.向后看,它似乎被定义为公正libexec/git-core.因此,我们需要查看system_path()的作用.
我不确定是否RUNTIME_PREFIX为你定义.但是在Makefile中输入时,我确实注意到前缀默认为$(HOME).我怀疑这可能是你问题的原因.
简单的答案就是把它放进去~/.bashrc:
export GIT_EXEC_PATH=/opt/local/libexec/git-core
如果你想了解更多有关正在发生的事情,你可能需要使用port -d upgrade -f git-core(或类似的)重新编译git 并仔细查看构建日志以查看正在设置前缀的位置.顺便说一句,port cat git-core显示大量使用${prefix}它应该(希望)显而易见.