Subl работает в терминале, но не как редактор по умолчанию в git - PullRequest
2 голосов
/ 23 апреля 2019

Попытка установить Sublime в качестве редактора по умолчанию в git.

git config --list возвращает

core.editor=subl -n -w
push.default=upstream
merge.conflictstyle=diff3

subl .bash_profile открыть этот файл в Sublime

# Enable tab completion
source ~/git-completion.bash

# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[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, он возвращает

 * 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

1 Ответ

0 голосов
/ 23 апреля 2019

Если работает Sublime по полному пути, также должен работать тот же путь для core.editor.Попробуйте следующее:

git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
...