Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Git Basics Getting Started With Git Committing Changes

No way to save and exit

Trying to add a commit for a README file: 'git commit README' I type in my message but there is no way to save and exit. Ctrl-x does not work or anything. I am using the OSX terminal. I tried to update and download the latest version of git but it still does not work.

8 Answers

Marco Boretto
Marco Boretto
29,821 Points

You have Vim set as the default editor for git. You need to re config git and set nano as the default editor. Just type in the console:

git config --global core.editor "nano"

cheers

Thank you so much ! That is extremely helpful !

Woohoo . I had figured out how to temporarily change it but this is wonderful.

Nahum Maciel
Nahum Maciel
3,801 Points

I had a similar issue to Jake's, but mine was windows and I was trying to make NotePad my default editor. Your command worked Marco.

Thank you

Aaron HARPT
Aaron HARPT
19,845 Points

Here are the steps you should use:

  1. nano README
  2. add some text
  3. ctrl + x
  4. y
  5. hit enter

I can do that in the README file, however I can't commit it using 'git commit README'

I appreciate you trying to help !

Eric Thompson
Eric Thompson
9,858 Points

This is the answer I think most of us were looking for! Thanks Aaron

Aaron HARPT
Aaron HARPT
19,845 Points

I believe it is taking you to vim, you need to type i, then write your message, then hit escape then :wq

Ah. How do I make it so it does not pull up Vim, but instead simply uses Git and the Terminal ?

Thanks a lot.

Jane Eyer
Jane Eyer
2,586 Points

If ctrl + x does not work for you then your git is using vim. In that case, Press esc and type ":wq" (w- means for write, q - means for quit) and press enter.

In the future if you want to use nano as a default text editor. then go to the main screen on terminal. type: nano ~/.gitconfig

The above command line will open an empty file and in the empty file type: git config core.editor "nano"

then press ctrl + x and enter to save and get out.

Happy gitting :D

Aaron HARPT
Aaron HARPT
19,845 Points

Try ctrl x, y then hit enter.

I am unable to do that. Ctrl-x is doing absolutely nothing.

Aaron HARPT
Aaron HARPT
19,845 Points

what text editor are you using?

I am using the OS X terminal.

Aaron HARPT
Aaron HARPT
19,845 Points

Are you trying to commit a change? The correct command for that would be

git commit -m "commit message"

In the video we are told to 'nano README' 'git add README' 'git commit README'

When I am taken to the page to commit the README file, there is nothing on the bottom which says different commands I can use to save, exit, etc.

I know however, that ctrl-x is used to exit so I try that but it simply does not work.

I have tried to delete the directory and try again but nothing seems to work.

Now, on the bottom, in bold writing it says "recording" in which the letter 'e' lets me scroll right and 'x' deletes characters. I have no idea what is going on.

Thanks.

I tried again and when I hit 'ctrl-x' this comes up '-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)'

Aaron HARPT
Aaron HARPT
19,845 Points

git commit -m "message" instead of git commit "file". I do not know how to make something else the default text editor.