gpt4 book ai didi

Git别名问题

转载 作者:IT王子 更新时间:2023-10-29 01:28:48 25 4
gpt4 key购买 nike

我试图通过将这些行添加到我的 ~/.gitconfig 文件来设置一些 git 别名:

[alias]
st = status
ci = commit
br = branch

当我在终端中运行这些命令时:git st,我收到以下错误 fatal: cannot exec 'git-st': Not a directory .我不知道问题出在哪里,我在网上看过也找不到为什么会这样。我正在使用 Git 1.7.1 运行 Mac OS 10.6.4。有人请帮帮我。如果我不明白为什么要这样做,我会发疯的!谢谢!

最佳答案

unutbu正确指出了 git-osx-installer issue 53 ,其中指出:

Basically, I had /root/bin in my path and didn't have permissions for that directory.

Interestingly, this was not a problem with git 1.6.3, but it was with 1.7.0 and 1.7.1.

A strace -f -eexecve git st 2>&1 | grep EACC可以帮忙看看是什么目录有问题:

[pid 6469] execve("/usr/games/bin/git-st", ["git-st"], [/* 72 vars */]) = -1 EACCES

(在本例中,/usr/games/bin/)

Another way找到有问题的路径是:

echo $PATH |tr ':' '\n' |xargs ls -ld

One of my invalid items is actually an NFS mounted directory that I don't have permission to access because I have not authenticated via Kerberos to the corporate NFS server.
Removing that one item from the PATH fixes the issue, and 'git stat' (my alias for status) now works.


PeterT在评论中提到您可能没有 strace可用(如 Solaris 中的 or OsX ,详见“Equivalent of strace -feopen < command > on mac os X ”),在这种情况下 dtruss 是一个很好的等价物。

dtruss -f -t execve git st 2>&1 | grep EACC

关于Git别名问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4019501/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com