Textmate git 命令失败并显示“sh: line 1: git: command not found”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1269104/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Textmate git commands fail with 'sh: line 1: git: command not found'
提问by Will Harris
When trying to use some of the commands from the Git bundle for TextMate (eg. 'Show Uncommited Changes') I get an error message like 'sh: line 1: git: command not found'.
当尝试将 Git 包中的某些命令用于 TextMate(例如“显示未提交的更改”)时,我收到一条错误消息,如“sh: line 1: git: command not found”。
How do I make TextMate work with Git?
如何让 TextMate 与 Git 一起工作?
回答by John Millikin
http://theappleblog.com/2008/01/09/textmate-no-longer-a-reason-to-avoid-git/
http://theappleblog.com/2008/01/09/textmate-no-longer-a-reason-to-avoid-git/
Set the TM_GIT shell variable in the textmate preferences to your git executable to work to solve the command not found problem.
将 textmate 首选项中的 TM_GIT shell 变量设置为您的 git 可执行文件以解决未找到命令的问题。
To find the path to your git binary, type "which git" on the command line. And of course, make sure Git is installed.
要查找 git 二进制文件的路径,请在命令行中输入“which git”。当然,请确保安装了 Git。
回答by conny
If you already allowed git-osx-installerto make git available to non-CLI applications (i.e. it planted a file in /etc/paths.d/git) then you could just..:
如果您已经允许git-osx-installer使 git 可用于非 CLI 应用程序(即它在/etc/paths.d/git 中植入了一个文件),那么您可以......:
Untick the PATH shell variable set by default in the textmate preferences.
回答by spaghetticode
I recently run in the same problem with Snow Leopard, and none of the above solutions was apperaring to be working. So I made a symlink in /usr/bin
to my git executable file like this:
我最近在使用 Snow Leopard 时遇到了同样的问题,上述解决方案似乎都不起作用。所以我在/usr/bin
我的 git 可执行文件中创建了一个符号链接,如下所示:
cd /usr/bin
sudo ln -s `which git` git
then relaunched Textmate
and it worked like a charm, without adding any variable or whatever
然后重新启动Textmate
,它就像一个魅力,没有添加任何变量或其他任何东西
回答by Eric D. Fields
Also, once you add the TM_GIT var, restart TextMate. Didn't work for me after the preference change without a restart.
此外,一旦添加了 TM_GIT 变量,请重新启动 TextMate。在没有重新启动的情况下更改首选项后对我不起作用。
回答by Peter Theill
@Radamanthus You shouldn't run "sh git" from your commandline. You should run "git" directly. Also, you should use the which command (run "which git") to get a path to your git binary (as mentioned by @John Millikin).
@Radamanthus 您不应该从命令行运行“sh git”。你应该直接运行“git”。此外,您应该使用 which 命令(运行“which git”)来获取 git 二进制文件的路径(如@John Millikin 所述)。
回答by Blake Taylor
Add the location of your git to the PATH shell variable in TextMate > Preferences... > Advanced > Shell Variables
.
将 git 的位置添加到 PATH shell 变量中TextMate > Preferences... > Advanced > Shell Variables
。