0

Having a problem with Nano on Ubuntu 12.04 when initiating a git commit command. When I launch a commit (e.g., git commit -a -m "some text") it brings up Nano which is completely unresponsive to any kb commands including the ctrl- commands on the bottom menu.

The following is what is displayed from Nano:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Committer: root <root@user-Ubuntu.(none)>
#
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file:   controller/ContactsController.php
#       new file:   index.php
#       new file:   model/ContactsGateway.php
#       new file:   model/ContactsService.php
#       new file:   model/ValidationException.php
#       new file:   view/contact-form.php
#       new file:   view/contact.php
#       new file:   view/contacts.php
#       new file:   view/error.php
#

Any help would be appreciated.

Thanks!

webdev
  • 741
  • 5
  • 16
  • Your `$EDITOR` shouldn't be triggered when you use the `-m` option to Git since you are providing the commit message on the command line. Are you certain that you are using this option? – ChrisGPT was on strike Jan 01 '14 at 19:21
  • My thoughts exactly, exact command is - "gksu git commit -a -m "sample text" and Nano pops up, completely frozen. – webdev Jan 01 '14 at 19:25
  • I always get uneasy seeing people commit as `root`. Having said that, if you `su` to `root` first, then run `git commit -a -m "sample text"`, does it work? – ChrisGPT was on strike Jan 01 '14 at 19:30
  • I'm new to Ubuntu, so if not committing from root, what's the best practice? To your query, I'm unable to commit due to permissions without gksu, having said that after I run the command as above I enter my password then the Nano loads but completely unresponsive, thus causing me to close out the terminal window. – webdev Jan 01 '14 at 19:34
  • If the repository is in your home directory (very common) you should just be able to commit as your user. If it's in something like `/var/www/html`, I would recommend moving to your home directory or granting write to your user on that directory. Instead of using `gksu`, what happens if you use `sudo git commit -a -m "sample text"`? This is a terminal-based command that should do the same as the `gksu` command. – ChrisGPT was on strike Jan 01 '14 at 19:39
  • Look like using (sudo git commit -m "blah") worked, dunno why gksu brought up Nano. What is the main difference with sudo and gksu? – webdev Jan 01 '14 at 19:45
  • `gksu` may use `sudo` or `su` under the covers, and it uses the graphical popup window. I'm not sure why it would make a difference here, possibly because of an environment variable set in your desktop? – ChrisGPT was on strike Jan 01 '14 at 19:47
  • Cheers on the help mate and added informative info, much appreciated. – webdev Jan 01 '14 at 19:49

1 Answers1

0

Any time I see somebody committing to Git as root I get uneasy.

Having said that, try taking gksu out of the picture and using sudo directly:

sudo git commit -a -m "sample text"
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257