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

Daniel C. Avery
Daniel C. Avery
11,617 Points

Can't commit to the Repository - tried everything from previous video.

Here's what I've tried for Task 2:

git commit README.md -m "Added a README file."
git commit -a -m "Added a README file."

Why don't either of these work? I know nothing about Git, so I'm trying everything from the previous video and I don't understand why neither of these is the answer. Thanks!

You need to create a Git repository first - start here: www.github.com

Daniel C. Avery
Daniel C. Avery
11,617 Points

Thanks vash68, but since this was a task inside a lesson, the repository was already created and the file was already added to the staging area. I just didn't understand from the previous video that you didn't need to specify the exact name of the file or add "-a" to commit something. I still think this could be fixed.

Steven Snary
Steven Snary
17,540 Points

This was a little unclear to me as well - what I've deduced is that...

1 - The -a flag is used as a group command to add AND commit all the files in the current directory - if they haven't been already added using the git add command. eg.

git commit -a -m "commit message goes here"

This adds and commits all the files that have changes to them to the repository.

2 - However if the file that we want to commit individually has previously been added to the staging area but we've made changes to the file then we must first "add" that file again before we commit it individually. This is done using the 2-step process of:

git add <filename>
git commit -m "commit message goes here"

1 Answer

Daniel C. Avery
Daniel C. Avery
11,617 Points

Oh. Looks like I was supposed to answer:

git commit -m "Added a README file."

Still, this is kinda dumb in my opinion. Maybe someone should fix this or add a tip about it in the task.