subl 在终端中工作但不是 git 中的默认编辑器
subl working in Terminal but not as default editor in git
正在尝试将 Sublime 设置为 git 中的默认编辑器。
git config --list
returns
core.editor=subl -n -w
push.default=upstream
merge.conflictstyle=diff3
subl .bash_profile
在 Sublime 中打开此文件
# Enable tab completion
source ~/git-completion.bash
# colors!
green="\[3[0;32m\]"
blue="\[3[0;34m\]"
purple="\[3[0;35m\]"
reset="\[3[0m\]"
# Change command prompt
source ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory
export PS1="$purple\u$green$(__git_ps1)$blue \W $ $reset"
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
然而,当我运行git pull origin master
它returns
* branch master -> FETCH_HEAD
hint: Waiting for your editor to close the file... subl -n -w: subl: command not found
error: There was a problem with the editor 'subl -n -w'.
Not committing merge; use 'git commit' to complete the merge.
为什么在执行命令的时候提示找不到命令?
编辑:我运行正在使用 macOS Mojave 版本 10.14.3
如果 运行 Sublime 通过其完整路径工作,为 core.editor
提供相同的路径也应该工作。尝试以下操作:
git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
正在尝试将 Sublime 设置为 git 中的默认编辑器。
git config --list
returns
core.editor=subl -n -w
push.default=upstream
merge.conflictstyle=diff3
subl .bash_profile
在 Sublime 中打开此文件
# Enable tab completion
source ~/git-completion.bash
# colors!
green="\[3[0;32m\]"
blue="\[3[0;34m\]"
purple="\[3[0;35m\]"
reset="\[3[0m\]"
# Change command prompt
source ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory
export PS1="$purple\u$green$(__git_ps1)$blue \W $ $reset"
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
然而,当我运行git pull origin master
它returns
* branch master -> FETCH_HEAD
hint: Waiting for your editor to close the file... subl -n -w: subl: command not found
error: There was a problem with the editor 'subl -n -w'.
Not committing merge; use 'git commit' to complete the merge.
为什么在执行命令的时候提示找不到命令?
编辑:我运行正在使用 macOS Mojave 版本 10.14.3
如果 运行 Sublime 通过其完整路径工作,为 core.editor
提供相同的路径也应该工作。尝试以下操作:
git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"