问题答案

我的情况是这样的: 公司的git服务器在另一台机器上,我使用的是一台开发机 git的大部分命令可用,少数几个不可用,例如 git pull,git rebase,git stash

检查了一下权限 strace -f -eexecve git pull 2>&1 | grep EACC 提示 [pid 26018] execve("/root/libexec/git-core/git-pull", ["git-pull"], [/* 22 vars */]) = -1 EACCES (Permission denied) 但是git-pull这个目录是在root下的,修改了这个目录的权限后,仍然不可访问 请问这种情况怎么解决好呢? 还是说压根儿就是我git的权限有问题? 先谢谢了

标签: git
答案

试试git fetch/cherry-pick如果没有提示权限问题,很肯能就是链接提到的问题了:

Then the next thing to try is probably (assuming you are running Linux): Well, kind of: it's CentOS, which I'm finding quite recalcitrant (e.g. I had to install strace). strace -f -e execve git pull

Though I suspect we may just see:

execve("/opt/libexec/git-core/git-core/git-pull", ...) = -1 EACCES (Permission denied)

which doesn't help much. I just want to be sure that is the source of the problem. No, the output is interesting. The permissions denied is from the erroneous /root install (see separate email):
[pid 3485] execve("/root/libexec/git-core/git-pull",
["git-pull"], [/* 18 vars */]) = -1 EACCES (Permission denied)

It looks in /opt/bin, but not /opt/libexec.
That looks like you are either running wrong git binary (one in /root/bin?) or the git installation is busted.

No, the git libexec directory SHOULD NOT be in PATH (git will add it there when needed).

举一反三