Git 别名问题
我试图通过将这些行添加到我的 ~/.gitconfig
文件中来设置一些 git 别名:
[alias]
st = status
ci = commit
br = branch
当我在终端中运行这些命令时:git st
,我收到以下错误致命:无法执行'git-st':不是目录
。我不知道问题是什么,我在网上查看过,但找不到它为什么这样做。我正在使用 Git 1.7.1 运行 Mac OS 10.6.4。有人请帮帮我。如果我不明白它为什么这样做,我会发疯的!谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
unutbu 正确指出了 git-osx-installer 问题 53,其中指出:
strace -f -eexecve git st 2>&1 | A strace -f -eexecve git st 2>&1 | grep EACC 可以帮助查看哪个目录出现问题:(
在本例中为
/usr/games/bin/
)另一种查找有问题的路径的方法是:
PeterT 在评论中提到您可能没有
strace
可用(就像在 Solaris 中< a href="http://opensourcehacker.com/2011/12/02/osx-strace-equivalent-dtruss-seeing-inside-applications-what-they-do-and-why-they-hang/" rel=" noreferrer">或 OsX,详见“相当于 mac os X 上的strace -feopen
"),在这种情况下dtruss
是一个很好的等效项。unutbu correctly pointed out to the git-osx-installer issue 53, which states:
A
strace -f -eexecve git st 2>&1 | grep EACC
can help see what directory is the problem:(in this instance, the
/usr/games/bin/
)Another way to find the path with the problem is:
PeterT mentions in the comment that you might not have
strace
available (like in Solaris or OsX, as detailed in "Equivalent ofstrace -feopen < command >
on mac os X"), in which casedtruss
is a good equivalent.我也遇到了这个问题,但原因略有不同:
在我的情况下,路径包含一个文件而不是目录的条目。文件本身及其目录的权限都很好。当加载新终端时,可以从任何地方运行该文件。然而,git 给出了相同的错误消息。
因此,除了在路径上查找权限不正确的文件夹之外,我建议遇到此问题的其他人也检查该路径是否仅指向文件夹而不指向文件。
I had this problem too but with a subtly different cause:
In my case the path contained an entry that was a file rather than a directory. The permissions on the file itself and its directory were fine. When a new terminal was loaded the file could be run from anywhere. However, git gave an identical error message.
So as well as looking for folders on the path with incorrect permissions I suggest anyone else with this problem also checks that the path points only to folders and not to files.
安装 Foundation 后在 OSX 中发现同样的问题。
我的 .bash_profile 中的违规行是格式错误的基础导出路径。我没有删除该行末尾的 /foundation,因此它指向一个二进制文件,而不是文件夹。
只是修好了它,重新加载终端,一切又恢复正常了。
Found the same problem in OSX after installing Foundation.
The offending line in my .bash_profile was a malformed foundation export path. I didn't remove the /foundation at the end of the line, so it was pointing to a binary file, not a folder.
Just fixed it, reloaded Terminal and everything worked again.
我也遇到了同样的问题,这是一个格式错误的 .bash_profile 行。
当我安装 WP_CLI 时,它将以下行添加到我的 .bash_profile 中,
我必须对其进行轻微的更改。我正在使用 CentOs 来解决这个问题。
这解决了我的问题。
I had the same problem too, and this was a badly formatted .bash_profile line.
When I installed WP_CLI, it added the following line to my .bash_profile
I had to make a slight change for it. I'm using CentOs for that matter.
This fixed my problem.
Git 还有一个内置的别名命令。
别名命令示例:
Git also has a built in alias command.
Example alias commands: