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

Philip Powis
Philip Powis
7,625 Points

Getting Started with Git: Committing Changes Issue


I am following along in this video, and in the my_really_cool_projects folder we are using git commit for the first time.

In the video, Tommy does this and it opens up in nano. On my mac, it opens in VIM. I can't figure out what to do next? I don't know the vim shortcut for Save.

At any rate, I'd like to be able to open git commit in nano so I can follow the tutorials.

In addition to this, I now have a different problem in that if I try to run git commit again, I get:

Swap file ".git/.COMMIT_EDITMSG.swp" already exists!

Can someone help me get back on track?

1 Answer

Philip Powis
Philip Powis
7,625 Points

Solved this on my own. I figured out how to set nano as the default editor for git. The command to do this is:

git config --global core.editor nano

This got me back on track!

I also noticed there was another solution provided in the notes for the video. Not sure what the difference is, but this seemed to work for the level that I am operating at :)

Tommy Morgan
Tommy Morgan
Treehouse Guest Teacher

Hey Philip Powis -

The difference is that the solution I provided in the teaching notes sets the default editor for your console session, whereas using the git config like you did makes it the default editor only for git. For the purposes of this course, they're equivalent :)

James Barnett
James Barnett
39,199 Points

Tommy Morgan I'm guessing in the teacher notes you used export EDITOR=nano?