【问题标题】:How can I set VScode as core editor in git /macbook如何在 git /macbook 中将 VScode 设置为核心编辑器
【发布时间】:2019-08-18 13:45:25
【问题描述】:

我无法将 Visual Studio Code 设置为我的 git 核心编辑器。当我尝试执行 git commit 时,我只看到编辑器存在问题的信息。

MacBook-Air-Agata:~ agataskrzypczyk$ git config --global core.editor "/Applications/Visual Studio Code.app" --wait

MacBook-Air-Agata:~ agataskrzypczyk$ git config --global core.editor
/Applications/Visual Studio Code.app

MacBook-Air-Agata:~ agataskrzypczyk$ cd nowy

MacBook-Air-Agata:nowy agataskrzypczyk$ git commit

hint: Waiting for your editor to close the file... /Applications/Visual Studio Code.app: /Applications/Visual: No such file or directory
error: There was a problem with the editor '/Applications/Visual Studio Code.app'.
Please supply the message using either -m or -F option.
MacBook-Air-Agata:nowy agataskrzypczyk$

【问题讨论】:

标签: git visual-studio-code


【解决方案1】:

我建议您将 Visual Studio Code 选项设置为从命令行启动。为此,请按照文档 here 中的说明进行操作。

  • 启动 VS 代码。
  • 打开命令面板 (⇧⌘P) 并输入 'shell command' 来查找 Shell 命令:在 PATH 中安装 'code' 命令 命令。

然后尝试使用以下命令设置核心编辑器:

git config --global core.editor "code --wait"

然后我认为git commit 不会有问题。

【讨论】:

  • 提示:等待您的编辑器关闭文件...错误:无法运行 atom:没有这样的文件或目录错误:无法启动编辑器 'atom' 请使用 -m 或-F 选项。
  • 为我工作!在上面的代码行之后运行git commit --allow-empty,没有问题!谢谢!
【解决方案2】:
git config --global core.editor "code"

【讨论】:

  • 请添加一些解释,您的解决方案如何解决问题
  • 以管理员身份在我的 cli 中运行它,然后我在 phpstorm 中输入 git commit 并打开 vs code ...允许我在 vs code 中输入我的提交消息。谢谢你。
猜你喜欢
  • 2019-06-30
  • 1970-01-01
  • 2021-04-10
  • 2020-09-10
  • 2016-09-22
  • 2015-09-04
  • 2014-05-03
  • 1970-01-01
  • 2010-09-05
相关资源
最近更新 更多