首页 > 解决方案 > 如何使用 git commit 打开 Sublime Text 3 编辑器

问题描述

我已经将 Sublime Text 3 配置为 git Bash 的文本编辑器。输入时 Sublime 成功打开subl 'filePath'

但是,当我尝试 git commit 时,文本编辑器无法打开并输出以下错误:

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'.
Please supply the message using either -m or -F option.

我已将文件添加到暂存区并准备提交。

标签: gitsublimetext3git-commit

解决方案


你可以试试这个

您可以在 Git 中设置默认编辑器以使用 Sublime Text 3。

  1. 安装 Sublime Text 3。

  2. 打开 Git Bash。

  3. 键入此命令:

git config --global core.editor "'C:/Program Files (x86)/sublime text 3/subl.exe' -w"

推荐阅读