【发布时间】:2017-01-21 14:45:50
【问题描述】:
当我尝试使用 Git Bash 使用 Sublime 进行 Git 提交时,我收到以下错误:
error: cannot spawn subl: No such file or directory
error: unable to start editor 'subl'
Please supply the message using either -m or -F option.
我尝试通过尝试这些不同的命令将 Git 配置为在提交期间使用 Sublime,但没有成功:
git config --global core.editor "'c:/program files/sublime text 3/subl.exe' -w"
git config --global core.editor "'C:/Program\ Files/Sublime\ Text\ 3/sublime_text.exe' -w"
git config --global core.editor "subl -n -w"
我已经设置了 Git Bash 来打开 Sublime 编辑器,它工作得非常好。我已经使用这个命令来实现这一点:
echo 'alias subl="C:/Program\ Files/Sublime\ Text\ 3/sublime_text.exe"' >> ~/.bashrc
顺便说一句,我使用的是 Windows 10。
【问题讨论】:
-
git config core.editor "'C:\Program Files\Sublime Text 3\subl.exe' -w"为我工作。我的.gitconfig说editor = 'C:\\Program Files\\Sublime Text 3\\subl.exe' -w或editor = 'C:/Program Files/Sublime Text 3/subl.exe' -w——两者都适合我。 -
感谢您的帮助!出于某种原因,它可以与反斜杠一起使用,正如您所建议的那样。
标签: git bash sublimetext3 git-bash