ryanwc
ryanwc

Reputation: 179

Git: Permission Denied when Opening Text Editor

I am trying to set the text editor that will open when Git needs me to type something (e.g., message for a commit).

I am on Mac OSX 10.9.5 and using bash. I have configured the default editor to TextEdit - my .gitconfig file looks like this:

[user]
    name = My Name
    email = [email protected]
[core]
    autocrlf = input
    safecrlf = true
    editor = /Applications/TextEdit.app

However, Git will not allow me to open 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.

I also tried to move TextEdit into my user directory, but I can only move an alias (I think it's just a pointer to the original TextEdit location). So, I get the same result. But, it's just a problem with Git, because this works:

MyMac:aDir user$ open ~/Applications/TextEdit

How can I get Git to let the user (the ONLY user on this computer) open TextEdit?

Upvotes: 3

Views: 1554

Answers (1)

sdayal
sdayal

Reputation: 1166

By having editor = open -W -n in your .gitconfig

Assuming Textedit is your default editor on Mac you need to specify open -W -n against editor in your .gitconfig

While doing git commit, the file will automatically open in Textedit

[user]
    name = My Name
    email = [email protected]
[core]
    autocrlf = input
    safecrlf = true
    editor = open -W -n

Upvotes: 7

Related Questions