Git:打开文本编辑器时权限被拒绝



我正在尝试设置文本编辑器,该编辑器将在Git需要我键入内容时打开(例如,提交消息)。

我在Mac OSX 10.9.5上使用bash。我已经将默认编辑器配置为TextEdit-我的.gitconfig文件如下所示:

[user]
    name = My Name
    email = MyEmail@host.com
[core]
    autocrlf = input
    safecrlf = true
    editor = /Applications/TextEdit.app

但是,Git不允许我打开TextEdit:

MyMac:aDir user$ git commit
fatal: cannot exec '/Applications/TextEdit.app': Permission denied
error: unable to start editor '/Applications/TextEdit.app'
Please supply the message using either -m or -F option.

我还试图将TextEdit移动到我的用户目录中,但我只能移动一个别名(我认为它只是指向原始TextEdit位置的指针)。所以,我得到了同样的结果。但是,这只是Git的一个问题,因为它有效:

MyMac:aDir user$ open ~/Applications/TextEdit

我如何让Git让用户(这台计算机上唯一的用户)打开TextEdit?

通过在.gitconfig中包含editor = open -W -n

假设Textedit是Mac上的默认编辑器,则需要针对.gitconfig 中的编辑器指定open -W -n

在执行git提交时,该文件将自动在Textedit 中打开

[user]
    name = My Name
    email = MyEmail@host.com
[core]
    autocrlf = input
    safecrlf = true
    editor = open -W -n

最新更新