【问题标题】:How to make Atom open when I type "git commit"当我输入“git commit”时如何打开Atom
【发布时间】:2020-07-20 17:21:47
【问题描述】:

当我输入 git commit 时,Atom 应该打开,但它没有。

对于命令提示符下的配置,我输入:

config --global core.editor "atom --wait"

当我输入时:

git commit

上面写着:

hint: waiting for your editor to close the file .......

error: there was a problem with the editor  "atom --wait"

Please supply the message using either -m or -F option.

【问题讨论】:

  • 你应该使用 git commit 和 -m 选项。因为 git commit 总是需要一个解释消息。例如:git commit -m "添加搜索功能"
  • 但在我观看的视频中,他们只是使用了“git commit”,而没有使用 -m 或其他东西。
  • 如果在命令行提示符($ 或其他任何内容)下输入命令:atom --wait somefile.ext,会发生什么情况?那行得通吗?如果是这样,它会做什么:它是否调用atom 编辑器然后等待它退出,以表明您已完成文件编辑?如果没有,调用atom 并等待它退出的做什么
  • @torek 嘿,感谢您的回复,但由于我无法让我的 atom 工作,如果我能解决,我只是删除并重新安装。它没有解决它,然后我将我的 core.editor 设置为默认的“vim”,现在它可以工作了。
  • 我自己使用 vim,它是一个非常好的编辑器。如果您确实想让 atom 工作并使用 atom,请遵循上述想法:了解如何从命令行调用 atom。一旦你知道如何做到这一点,你就知道如何指示 Git 做到这一点。 core.editor 设置是告诉 Git 使用什么命令行命令来调用首选编辑器的方式。

标签: git atom-editor


【解决方案1】:

正如“Git commit fails: "Please supply the message using either -m or -F option."”中所述,您应该检查您的git config core.editor 值。 它可能指的是一个带有空格的路径,不带引号。

确保在注册该编辑器路径时使用单引号, 并在所有注册的命令表达式周围加上双引号,以及 '/' 而不是 '\' 作为路径分隔符。

git config core.editor "'C:/path/with spaces/xxx.exe' -<someoptions>"

【讨论】:

  • $ git config core.editor "'C:/Users/bilim/AppData/Local/atom/atom.exe'" 致命:不在 git 目录中,它给了我一个错误,我不能做。所以生病只是尝试观看 youtube 系列或找到一些教程.. 感谢您的回复
  • 因为执行此命令时需要在 git 存储库中
  • @Semih 使用 git --global config ...,那么你就不需要在 git repo 中了。我认为 pcampana 错过了您问题中的全球标志。
  • @wjandrea 谢谢,我刚刚通过将编辑器更改为 vim 解决了这个问题 :) 但感谢你们俩的回答。
猜你喜欢
  • 1970-01-01
  • 2020-04-29
  • 2016-06-26
  • 2016-01-24
  • 2018-11-27
  • 1970-01-01
  • 2015-01-11
  • 2023-04-10
  • 1970-01-01
相关资源
最近更新 更多