I just want to edit some commits with git rebase -i HEAD~2
inside the current branch. I am using Ubuntu 10.10 and I had to install gvim first for the command to work. After that, the command opens the gvim window with the normal forwarding contents. But when I want to save the file, gvim says
". git / rebase-merge / git -rebase-todo" E212
[Unable to open file for writing]
The rebase command also ends immediately after starting (using Successfully rebased and updated refs/heads/master.
).
When executing the same command with sudo
rebase works, but then it happens that the files are owned by root, and I no longer have write permissions.
On my ArchLinux system, gvim opens directly in the terminal, where I run git rebase -i
, and everything works.
- I tried different terminals (terminal Gnome, LXTerminal, XTerm) - always the same problem
What is the problem and how to solve it? It should work without sudo.
Change 1
- Some files in
.git/...
owned by root and are read-only. All directories and files on the first level .git/
belong to me. Using ls -l --recursive .git/ | grep root
ls -l --recursive .git/ | grep root
I tried to determine what files are, but the output does not give the paths to the files ... - Should all files in
.git/
belong to the user? Could this be the cause of the problem?
EDIT 2
- Even after changing permissions and writing all files inside
.git
to a 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 remains the same.
source share