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

git add won't work

Getting Started with Git, tried to add file README.md using git add, not working.

8 Answers

very helpful indeed

Why not

git remote add README.md

I know this doesn't work, but I'm not sure why we wouldn't be using remote.

Hi Catherine, this is what I do. 1.) Check git status. It should list all the files that changed, or give you an error message if you don't have git initialized (if it isn't, type in git init).

git status

2.) Add the files

git add .

3.) Commit the files.

git commit -am "Updated README.md"

4.) I recheck git status again. It should state that there isn't anything to add. Or you can check the log, it should list the commit message with date, etc. and to exit the log just hit the letter "q" on the keyboard.

git log

commit 8f3ba18a9671511214f72734dfa716f9e7275d23
Author: ninjashanij 
Date:   Wed Jan 7 09:07:36 2015 -0800

    Updated README

commit 70d796000d6ead2b502aed71bf1a96f93cfa3649
Author: ninjashanij 
Date:   Wed Jan 7 08:42:52 2015 -0800

    Initialize repository
Sam Roberton
Sam Roberton
7,225 Points

No problem, git commit can be done in slightly different ways.

git commit -am "Commit message for log"

# or

git commit -a -m "Commit message for log"

Since the task before gets you to add the file manually you can forget the -a so...

git commit -m "Commit message for log"

Hope that helps :)

I swear I typed that and didn't work, copied and pasted your text in and it worked, very frustrating. Now git commit won't work. And Thanks ! I've been going in a circle here.

"We've created a new file in this repository called README.md. Add it to the repository so that git knows to track it." I've tried what you typed, tried a few of my own; i.e., git commit README.md or I've put the README.md in quotes. No luck. I'm not enjoying git very much.

Well, I finally got it, I put in git commit -a -m READEME.md; I think, can't remember now, I've been going in circles so long, LOL.

Thank you ! I am seeing it takes practice, practice, practice. Hopefully it will sink in. :-)

It does take practice. I had to write it down on an index card and keep it nearby, until I had it memorized - on the flip-side: once you get it, you'll wonder why you didn't know about it sooner! Happy coding!

I keep trying nothing is working