I simply want to edit some commits with git rebase -i HEAD~2
inside the current branch.
I use Ubuntu 10.10 and had to install gvim first to make the command work.
Afterwards, the command opens a gvim window with the normal rebase content.
But when I want to save the file gvim says
".git/rebase-merge/git-rebase-todo" E212
[Cannot open file to write]
Also the rebase command finishes right after starting (with Successfully rebased and updated refs/heads/master.
).
When doing the same command with sudo
the rebase works, but afterwards it occurs that files are owned by root and I have no write permissions anymore.
On my ArchLinux system gvim is opened directly in the terminal where I run git rebase -i
and everything works.
What is the problem here and how to solve it? It should work without sudo.
.git/...
are owned by root and are read-only. All directories and files in the first level of .git/
are owned by me. With ls -l --recursive .git/ | grep root
I tried to detect which files that are but the output does not give the paths of the files....git/
belong to the user? May this be the reason for the problem?.git
to user with sudo chown -R user:user .git/
and chmod u+w -R .git/
(ls -l
now shows sth. like -rw-r--r-- 1 user user
) the problem stays the same.My solution was:
Run
$ git config --global core.editor "gvim -f"
First, I thought it was because my repository was on an ntfs drive so the file permissions wouldn´t work correctly. But even after mounting the drive with correct file permissions the problem stayed the same. Starting vim with the -f
option helps (I read about other people solving it the same way), but I don´t know why.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With