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 trialJake Nisenboim
3,374 PointsNo 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
29,821 PointsYou 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
Aaron HARPT
19,845 PointsHere are the steps you should use:
- nano README
- add some text
- ctrl + x
- y
- hit enter
Jake Nisenboim
3,374 PointsI 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
9,858 PointsThis is the answer I think most of us were looking for! Thanks Aaron
Aaron HARPT
19,845 PointsI believe it is taking you to vim, you need to type i, then write your message, then hit escape then :wq
Jake Nisenboim
3,374 PointsAh. 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
2,586 PointsIf 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
19,845 PointsTry ctrl x, y then hit enter.
Jake Nisenboim
3,374 PointsI am unable to do that. Ctrl-x is doing absolutely nothing.
Aaron HARPT
19,845 Pointswhat text editor are you using?
Jake Nisenboim
3,374 PointsI am using the OS X terminal.
Aaron HARPT
19,845 PointsAre you trying to commit a change? The correct command for that would be
git commit -m "commit message"
Jake Nisenboim
3,374 PointsIn 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.
Jake Nisenboim
3,374 PointsI 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
19,845 Pointsgit commit -m "message" instead of git commit "file". I do not know how to make something else the default text editor.
Jake Nisenboim
3,374 PointsJake Nisenboim
3,374 PointsThank you so much ! That is extremely helpful !
Jake Nisenboim
3,374 PointsJake Nisenboim
3,374 PointsWoohoo . I had figured out how to temporarily change it but this is wonderful.
Nahum Maciel
3,801 PointsNahum Maciel
3,801 PointsI 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