我最近将我的MacBook专业版升级到雪豹版,"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这让我很惊讶,因为这个目录并不存在,也从来没有存在过。谷歌在这方面帮不上忙。希望您能:)
发布于 2009-09-23 13:32:37
查看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,最终将在exec_cmd.c中调用const char *git_exec_path(void)。它看起来像这样:
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);现在,当你说--exec-path=/some/where时,_argv_exec_path_就被设置了,所以可以打折。您已经声明了没有设置环境变量。GIT_EXEC_PATH是在Makefile编译期间定义的。回头来看,它似乎只被定义为libexec/git-core。因此,我们需要看看system_path()做了什么。
我不确定是否为您定义了RUNTIME_PREFIX。但是在查看Makefile时,我确实注意到prefix默认使用$(HOME)。我怀疑这可能是您的问题的原因。
简单的答案是将其放在~/.bashrc中
export GIT_EXEC_PATH=/opt/local/libexec/git-core如果你想了解更多的信息,你可能需要使用port -d upgrade -f git-core (或类似的)重新编译git,并仔细查看构建日志,看看在哪里设置了前缀。顺便说一句,port cat git-core显示大量使用了${prefix},所以它应该(希望)是显而易见的。
发布于 2009-09-23 11:28:57
有意思的。试试echo $GIT_EXEC_PATH,which git。这不太可能与雪兽…有关
发布于 2010-04-27 06:34:50
在我的系统上,libexec/git-core在/usr/local中,而不是在/opt/local中。对于我来说,/usr/local/libexec目录只有根用户可访问的权限,这解决了这个问题:
sudo chmod a+rx /usr/local/libexechttps://stackoverflow.com/questions/1465398
复制相似问题