git: "Warning: Changing a readonly file"
When I go to commit changes to a branch using,
git commit -a
vim is opened and I go to insert my commit message. I get this warning in the terminal:
W10: Warning: Changing a readonly file
In order to continue with the commit, I have to force write using :x! in vim, but otherwise, no problems are encountered.
At the least, this is seems to be just an annoyance. Does anyone know what's going on and/or how to fix this?
I am using Cygwin on Windows 7.
If the file .git/COMMIT_EDITMSG exists and is read-only, the simplest thing to do is to delete it - git will recreate it as necessary.
I had same problem....but there was a vi instance running still with that file open. No where on the screen i found that instance...so i killed it.
Deleting the file didn't fix it for me. Manually setting the core.editor configuration did. After running this command the problem went away for me.
git config --global core.editor "vim"
I do not know why, but this is what finally resolved the issue. $EDITOR was set to "vim" previously and core.editor was undefined before this fix.