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 trialChris Sunde
10,680 Pointsgit commit on Mac
I'm following the Git basics tutorial in the Terminal on my Mac and when I get to the part where you type "git commit" in the command line and then add the comment "Added a README file.", I can't seem to save and close to complete the commit. In the tutorial and if you use Treehouse's Console, you can hit ^X to exit and save. But ^X in my Mac Terminal gives another menu and does not close. What am I missing?
2 Answers
Stone Preston
42,016 PointsIt most likely opened Vim (its a text editor). type your commit message and then press Esc and then type :wq (w for write and q for quit) and see if it closes
Clara Hembree
11,401 PointsThank you, Stone. And thank you too, Chris, for posting the question. I did a quick search and found a lot of documentation out there on how to use vim with the terminal, but all the posts I came across are several years old.
Chris Sunde
10,680 PointsChris Sunde
10,680 PointsThanks, that worked! Is there any way to get the Mac Terminal or the "git commit" command to default to another text editor like Nano?
Stone Preston
42,016 PointsStone Preston
42,016 Pointsrun the following command:
git config --global core.editor "nano"
however almost all of the time I just use the -m flag and type the commit message inline. that way you dont even have to bother with a text editor
git commit -m "some commit message here"
Kotaro Ninomiya
4,819 PointsKotaro Ninomiya
4,819 PointsStone, I tried the configure my default to nano, but received this:
error: key does not contain a section: core
Can you please help?