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

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,735 Points

Can't get git commit to work on my own terminal.

I got it to work fine in the Treehouse console, but I tried it on my on Terminal and I got this message:

"~/my_really_cool_project/.git/COMMIT_EDITMSG" 13L, 304C

at the bottom of the screen, and I couldn't figure out how to save and exit.

3 Answers

Hi Brendan,

Sounds like you may have been bitten by the Vim bug! :) It's not actually a bug. Git opens Vim (a text editor) by default when it wants you to edit a commit message. Next time this happens just type

:wq

and that will exit you out. You can also set a different default editor by using:

git config --global core.editor emacs

(replace emacs with the editor of your choice - you may need to look up how git wants the name written).

Best, Cena

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,735 Points

I tried it and it just exited, it didn't let me edit, it just quit. Also why would this be the default behavior for git in my terminal but not git in the treehouse console?

Thanks for your help.

Well, if you want to edit with Vim, theres a workshop here for that. :)

The Treehouse console isn't a full-fledged terminal app such as you'd see on OSX or Linux, so doesnt have all the command line tools (like Vim) that you'd expect to be installed on a real operating system.

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