Git别名问题 [英] Git Alias Problem
问题描述
我试图通过将这些行添加到〜/ .gitconfig
文件中来设置一些git别名:
< pre $
[别名]
st =状态
ci =提交
br =分支
当我在终端中运行这些命令时: git st
,我得到以下错误 fatal:不能执行'git-st':不是目录
。我不知道问题是什么,我已经在网上查找,但无法找到它为什么这样做。我使用Git 1.7.1运行Mac OS 10.6.4。有人请帮助我。如果我不知道为什么这样做,我会发疯的!谢谢!
基本上,我有
/ root / bin
在我的路径中,并且没有该目录的权限。
有趣的是,这不是git 1.6.3的问题,但是它与
A strace -f -eexecve git st 2>& 1 | grep EACC
可以帮助查看问题的目录:
$ b $
[pid 6469] execve(/ usr / games / bin / git-st,[git-st],[/ * 72 vars * /])= -1 EACCES
(在这个例子中, / usr / games / bin /
)
另一种方式找到问题所在的路径是:
echo $ PATH | tr':''\\\
'| xargs ls -ld
其中一个无效项目实际上是一个NFS挂载的目录,我不介意没有权限访问,因为我没有通过Kerberos对企业NFS服务器进行身份验证。
从PATH
中删除该项目可解决问题,和'git stat
'(我的身份别名)现在可以运行。
彼得T 在评论中提到你可能没有 strace
可用(就像在Solaris or OsX ,详见<一个href =https://stackoverflow.com/questions/1925978/equivalent-of-strace-feopen-command-on-mac-os-x>相当于 strace -feopen<命令>
on mac os X ),在这种情况下 dtruss
是一个不错的等值。
dtruss -f -t execve git st 2>& 1 | grep EACC
I was trying to set up some git aliases by adding these lines to my ~/.gitconfig
file:
[alias]
st = status
ci = commit
br = branch
And when I go to run these commands in the terminal: git st
, I get the following error fatal: cannot exec 'git-st': Not a directory
. I do not know what the problem is and I have looked online and cannot find why it is doing this. I am running Mac OS 10.6.4 using Git 1.7.1. Somebody please help me out. If I don't figure out why it is doing this, I'll go crazy! Thanks!
unutbu correctly pointed out to the git-osx-installer issue 53, which states:
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
can help see what directory is the problem:
[pid 6469] execve("/usr/games/bin/git-st", ["git-st"], [/* 72 vars */]) = -1 EACCES
(in this instance, the /usr/games/bin/
)
Another way to find the path with the problem is:
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 thePATH
fixes the issue, and 'git stat
' (my alias for status) now works.
PeterT mentions in the comment that you might not have strace
available (like in Solaris or OsX, as detailed in "Equivalent of strace -feopen < command >
on mac os X"), in which case dtruss
is a good equivalent.
dtruss -f -t execve git st 2>&1 | grep EACC
这篇关于Git别名问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!