eidimon
eidimon

Reputation: 29

git- Committing using an editor for the message: The document “COMMIT_EDITMSG” could not be opened. You don’t have permission

I have a git repository, to which I could commit without any issues from other computers in the past. Now, on a new computer, I clone the repository, modify a file, and add it.

Then, I try commit, and apparently I had not set up editor correctly, so instead of TextEdit opening (which I wanted) Vi opens in the terminal editing the file. Vi is closed abnormally, and then I set up in bash the editor correctly, and try again. I try to commit using TextEdit (or other editors after that) to write the commit message, I get the following message in a popup window: 'The document “COMMIT_EDITMSG” could not be opened. You don’t have permission.'

This does not happen when I use git commit -m"..." in the terminal.

I know there are a few threads with relevant topics, which I have seen. For example: About fatal: could not open '.git/COMMIT_EDITMSG': Permission denied

could not open git/commit_editmsg

fatal: could not open '.git/COMMIT_EDITMSG': Permission denied

or

"unable to append to .git/logs/refs/heads/master" when commiting

to name a few.

I tried doing several things mentioned in them:

So far no luck. I can only commit doing git commit -m"..." (and then successfully push to remote), but never using an editor for writing the message.

In case it helps, OS is macOS Sierra.

If anyone has any idea what I could be doing wrong, or what I missed in the relevant topics, I would be grateful.

Upvotes: 0

Views: 2131

Answers (2)

user15143255
user15143255

Reputation:

Yaa! I also face this type of stuff. But is simple to solve. Open your folder you reserved as the repository and open your cmd on those paths and give the commands I suggest belowe.

attrib -h -s -r /s /d *.*

del.git/COMMIT_EDITMSG

so it is working guys.

Upvotes: 0

eidimon
eidimon

Reputation: 29

okay, after a lot of tries at different occasions, I found something that actually worked in my case:

I went and edited the config file in my local git repository. there, under [core], I added the following:

editor = open -a TextEdit -W

(using TextEdit as the desired editor)

For some reason, when I had the same in my bash profile file, the result was not the same...

Upvotes: 2

Related Questions