Git没有使用我的$ PATH中的第一个编辑器 [英] Git is not using the first editor in my $PATH
问题描述
我使用的是OS X 10.8,我使用brew来安装比OS X附带的更新版本的emacs。
更新的emacs二进制文件是安装在 / usr / local / bin
(24.2.1)中,以及 / usr / bin
(22.1.1)。
我更新了我的 $ PATH
env变量, code> / usr / local / bin 。它在我的shell中工作正常(即键入 emacs
运行24.2.1版本),但是当git打开编辑器时,emacs版本是22.1.1。
不是git应该使用 $ PATH
来查找我想要使用的编辑器吗?
其他信息:
$ type -a emacs
emacs是/ usr / local / bin / emacs
emacs是/ usr / bin / emacs
emacs是/ usr / local / bin / emacs
$ env
PATH = / usr / local / bin:/ usr / local / sbin:/ usr / bin:/ bin:/ usr / sbin:/ sbin:/ usr / local / bin
SHELL = / bin / zsh
PAGER = most
EDITOR = emacs -nw
_ = / usr / bin / env
请注意, d更喜欢不直接在我的git conf中设置编辑器的绝对路径,因为我在多个系统中使用此conf。
编辑:这是我的 .zshrc
:
#Mac OS X
if [`uname` =Darwin];然后
#Brew二进制文件
PATH =/ usr / local / bin:/ usr / local / sbin:$ PATH
else#其他所有人(Linux)
# snip
fi
所以,我可以添加一行在第一个
,但我想知道为什么 if
中输出EDITOR ='/ usr / local / bin emacs -nw' git
没有使用我的 PATH
变量:)
git 1.8.0
修复了这个问题。 旧版本是 1.7.9.6(Apple Git-31.1)
。这很奇怪,因为我没有在更新日志中找到任何对此类问题的引用。
I am using OS X 10.8, and I used brew to install a more recent version of emacs than the one shipped with OS X.
The newer emacs binary is installed in /usr/local/bin
(24.2.1), and the old "shipped-with-osx" one in /usr/bin
(22.1.1).
I updated my $PATH
env variable by prepending /usr/local/bin
to it. It works fine in my shell (ie. typing emacs
runs the 24.2.1 version), but when git opens the editor, the emacs version is 22.1.1.
Isn't git supposed to use $PATH
to find the editor I want to use ?
Additional informations:
$ type -a emacs
emacs is /usr/local/bin/emacs
emacs is /usr/bin/emacs
emacs is /usr/local/bin/emacs
$ env
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
SHELL=/bin/zsh
PAGER=most
EDITOR=emacs -nw
_=/usr/bin/env
Please note that I'd prefer not to set the absolute path of my editor directly in my git conf, as I use this conf across multiple systems.
EDIT: Here's an bit of my .zshrc
:
# Mac OS X
if [ `uname` = "Darwin" ]; then
# Brew binaries
PATH="/usr/local/bin":"/usr/local/sbin":$PATH
else # Everyone else (Linux)
# snip
fi
So, yes, I could add a line export EDITOR='/usr/local/bin emacs -nw'
in the first if
, but I'd like to understand why git
is not using my PATH
variable :)
Installing git 1.8.0
fixed the issue.
Old version was 1.7.9.6 (Apple Git-31.1)
. This is weird as I didn't find any references to this kind of problem in the changelogs.
这篇关于Git没有使用我的$ PATH中的第一个编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!