“git pull”破碎 [英] "git pull" broken
问题描述
我最近将我的MacBook Pro升级为Snow Leopard,并且git pull返回:
rakudo $ git pull
git:'pull'不是一个git命令。请参阅'git --help'
您的意思是?
shell
rakudo $ git-pull
-bash:git-pull:找不到命令
我试过通过macports重新安装,但无济于事。然后我看到这个
rakudo $ git --exec-path
/ Users / ovid / libexec / git-core
令我感到惊讶的是,该目录不存在,也不存在。 Google在这里没有帮助。希望你可以:)
寻找git的来源,git.c中有一条评论:
/ *
*我们使用PATH来查找git命令,但是我们预先安排了一些更高的
*优先路径: - -exec-path选项,GIT_EXEC_PATH
*环境以及构建
*时间的Makefile中的$(gitexecdir)。
* /
如果您调用 git --exec-path
,你最终会在 const char * git_exec_path(void) blob / master / exec_cmd.c#L72rel =noreferrer> 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 = /某些地方
可以打折。你已经声明环境变量没有设置。 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重新编译git -f git-core
(或类似)并仔细查看构建日志以查看正在设置前缀的位置。顺便说一下, port cat git-core
显示了大量使用 $ {prefix}
,所以它应该(希望)显而易见。
I recently upgraded my MacBook Pro to Snow Leopard and "git pull" returns:
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
I've tried reinstalling via macports, but to no avail. Then I saw this
rakudo $ git --exec-path
/Users/ovid/libexec/git-core
That surprised me as that directory does not exist, nor has it ever existed. Google is not helping here. Hopefully you can :)
Looking in the source of git, there's a comment in 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.
*/
If you call git --exec-path
, you end up calling const char *git_exec_path(void)
in exec_cmd.c. That looks like this:
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);
Now, _argv_exec_path_ is set when you say --exec-path=/some/where
so can be discounted. You've stated that the environment variable isn't set. GIT_EXEC_PATH
is defined during compilation in the Makefile. Going backwards, it seems to be defined as just libexec/git-core
. So, we need to look at what system_path() does instead.
I'm not sure whether RUNTIME_PREFIX
is defined for you. But while nosing in the Makefile, I did notice that prefix defaults to $(HOME)
. I suspect that this may be the cause of your problems.
The simple answer is to put this in ~/.bashrc
:
export GIT_EXEC_PATH=/opt/local/libexec/git-core
If you want to find out more about what's going on, you'll probably have to recompile git using port -d upgrade -f git-core
(or similar) and look closely at the build log to see where prefix is being set. Incidentally, port cat git-core
shows heavy usage of ${prefix}
so it should (hopefully) be obvious.
这篇关于“git pull”破碎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!