簡體   English   中英

git commit沒有打開編輯器

[英]git commit does not open editor

我有一個問題,每當我運行git commit時,這會出現:

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.

subl是sublime的別名。 我在Win10上運行git Bash。
如果我只是運行' subl ',它會subl打開編輯器,但是使用git commit它不會。 這是我的git配置文件:

[core]
    editor = subl -w -n

執行git config --global core.editor "\\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\\" %*"將Sublime配置為Windows中的編輯器。

編輯:以上假設您已安裝Sublime 3。 如果安裝了Sublime 2,請將完整路徑更改為sublime_text.exe的正確有效路徑。

Shell別名是shell的一個功能,而不是操作系統的功能。 因此它們只能由shell直接執行,而不能通過任何外部工具(如git

出於同樣的原因,您不能將別名與find -execxargssudo

如果您想要一種更短的方式來運行也適用於外部工具的東西,請創建一個具有該名稱的shell腳本。

嘗試將整個路徑設置為subl例如/usr/local/bin/subl或系統上的任何內容。 您可以通過執行終端中的which subl來查找。

有可能無論你的git運行什么,它都不知道你的別名。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM