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

User Not Found
PLUS
User Not Found
Courses Plus Student 385 Points

git commit doesn't work in windows git bash

In the git tutorial Tommy said->(I'm using notepad) "notepad README" then "git add README.txt" then "git commit " after that the console will say Changes to be committed: New file : README.txt the Tommy goes to the top line and he provide the message "ADDED A READ ME FILE" and does something and gets the success message but I cant get the success commit message.

4 Answers

When you're using the inline editing, you have to press ESCAPE, then type :wq, and press ENTER I'm on a Windows environment as well, and I had a problem here where nothing in the video told users how to escape and save the changes. I did a quick google search.

It's easier to just provide the git message inline with the commit. But if you don't then that's how you get outta there.

ESCAPE :wq (notice the colon) ENTER

User Not Found
User Not Found
Courses Plus Student 385 Points

That's great, thanks for helping me out ! Very detailed information as I needed !

Tom Bedford
Tom Bedford
15,645 Points

Hi Tavind,

Are you using Command Prompt or Git Bash to run your commands? If you're using Git Bash then the commands will work exactly the same as in the video tutorials. I believe Git Bash is included when you download the Windows version of Git.

If you are using Git Bash then have you initialised Git in that folder with git init?

User Not Found
User Not Found
Courses Plus Student 385 Points

Hi Tom,

Thank you for your answer I really appreciate it, I'm using git bash, I have completed the git init but the problem is the same, I have type in my message for exp : "Added README.txt" then what should I do ? any command I should use to enter ?

Tom Bedford
Tom Bedford
15,645 Points

If you've added the readme.txt with git add readme.txt you can commit with git commit -a -m "Added readme.txt"

This breaks down to git commit (the command you want to run) with the options -a to commit all staged files (in this case the readme.txt that has been added) and -m "Added readme.txt" to add that message.

You can check it's been committed using git status, this will list any files that have never been committed or that have been changed/deleted since the last commit. If there are no new or changed files it will state that there is nothing to commit.

User Not Found
User Not Found
Courses Plus Student 385 Points

That works pretty well :) Thank you Tom and Nice to meet you :)

Also, when you get to the video about checking out a previous version an use the

git checkout [commit hash/branch name]

command, you'll need to press Q at the end of the list to return to the prompt. Had to research that as well, as it wasn't discussed in the video.

User Not Found
User Not Found
Courses Plus Student 385 Points

Haven't yet reach there but when I do this post will be helpful again for me and other windows users, You're help is very appreciated. :)

Juan Aviles
Juan Aviles
12,795 Points

I'm having problems with Windows as well. I really like this course, but almost feel it should have been dry-run some more in a Windows environment before making the videos. It seems like a lot is left out.