Cannot commit changes made through tramp/sudo

73 views
Skip to first unread message

Matthew X. Economou

unread,
Apr 22, 2016, 11:16:35 AM4/22/16
to ma...@googlegroups.com
Dear all,

How do I debug this? Magit invokes sudo to read the git repo, but
somewhere its invocation of `git commit` fails, and I'm not seeing any
meaningful error in the *Messages* buffer:

Tramp: Opening connection for root@hostname net using sudo...
Tramp: Sending command `exec env SHELL=/bin/sh sudo -u root -s -H -p
Password:'
Tramp: Waiting for prompts from remote shell...
Tramp: Sending Password
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on `hostname'
Tramp: Opening connection for root@hostname using sudo...done
Tramp: Inserting `/sudo:root@hostname:/path/.git/COMMIT_EDITMSG'...
Copying /sudo:root@hostname:/path/.git/COMMIT_EDITMSG to
/tmp/tramp.99342UqK...done
Tramp: Inserting `/sudo:root@hostname:/path/.git/COMMIT_EDITMSG'...done
Tramp: Checking `vc-registered' for
/sudo:root@hostname:/path/.git/COMMIT_EDITMSG...
Type C-c C-c to finish, or C-c C-k to cancel
Tramp: Checking `vc-registered' for
/sudo:root@hostname:/path/.git/COMMIT_EDITMSG...done
Tramp: Inserting `/sudo:root@hostname:/path/.git/COMMIT_EDITMSG'...done
Saving file /sudo:root@hostname:/path/.git/COMMIT_EDITMSG...
Copying /tmp/tramp.99342h0Q to
/sudo:root@hostname:/path/.git/COMMIT_EDITMSG...done
Wrote /sudo:root@hostname:/path/.git/COMMIT_EDITMSG

At this point I've saved the commit message via C-c C-c, but when Emacs
returns to the *magit* buffer, the staged commits are still uncommitted.

How should I proceed?

Best wishes,
Matthew

--
"The lyf so short, the craft so longe to lerne."


Tim Visher

unread,
Apr 26, 2016, 10:33:07 AM4/26/16
to Matthew X. Economou, ma...@googlegroups.com
Do you really mean to be running git as root?

--
You received this message because you are subscribed to the Google Groups "magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to magit+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

and...@gmail.com

unread,
May 30, 2016, 7:52:52 AM5/30/16
to magit

I am suffering from this bug as well.

Why run git as root? In my case I use git to track changes in /usr/local/etc (its FreeBSD box), which is a root-owned segment of file system hierarchy.

Other Magit functions like stage/unstage, revert hunk etc work well, except Commit. So I must perform 'git commit' manually in shell at the moment.

and...@gmail.com

unread,
Jun 5, 2016, 10:13:04 AM6/5/16
to magit
On Friday, April 22, 2016 at 6:16:35 PM UTC+3, Matthew Economou wrote:

The issue was investigated. See: https://github.com/magit/magit/issues/2672

The solution is to configure with-editor to explicitly use Bash:

(setq with-editor-sleeping-editor "\
bash -c '\
echo \"WITH-EDITOR: $$ OPEN $0\"; \
sleep 604800 & sleep=$!; \
trap \"kill $sleep; exit 0\" USR1; \
trap \"kill $sleep; exit 1\" USR2; \
wait $sleep'")

Regards,
Andrew

Reply all
Reply to author
Forward
0 new messages