【问题标题】:How do I make git use the editor of my choice on Windows instead of Notepad.exe?如何让 git 在 Windows 上使用我选择的编辑器而不是 Notepad.exe?
【发布时间】:2016-02-10 17:52:25
【问题描述】:

我正在尝试让 git 使用 Sublime Text 提交消息和交互式变基,但每当我尝试运行 git rebase --interactivegit commit 时,出现的编辑器就是记事本。

我已经通过运行将 Sublime Text 3 配置为我的编辑器

git config --global core.editor "'C:/Program Files/Sublime Text 3/subl.exe' -n -w"

告诉 subl.exe 打开一个新窗口并等待输出。我已经确认我的 editor 设置在我的 .gitconfig 中设置正确:

editor = 'C:/Program Files/Sublime Text 3/subl.exe' -n -w

此外,我尝试在 git bash 提示符下(在文本文件上)运行subl.exe 命令,并验证 Sublime Text 确实为该文件打开了一个新窗口并等到该窗口关闭之前返回提示符。

我还应该看什么?似乎无论我做什么,git 都会尝试使用 notepad.exe。

【问题讨论】:

  • 我使用 Notepad++ 并且 ~/.gitconfig 中的以下行适用于我:editor = 'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession

标签: windows git sublimetext3


【解决方案1】:

事实证明,问题在于记事本在存储库自己的配置中被配置为我的编辑器。进入 repo 本身的 .git 文件夹并从 config 文件中删除记事本导致 git 再次识别全局配置。

【讨论】:

    猜你喜欢
    • 2011-02-05
    • 2010-09-05
    • 2011-07-15
    • 1970-01-01
    • 2015-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-06
    相关资源
    最近更新 更多