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

Nathan Brenner
Nathan Brenner
35,844 Points

fatal: Not a git repository (or any of the parent directories): .git

I'm on a pc with windows 7. I've created a repo and it appears on ls, and I've created a txt file that appears in ls. When I git add that file, I get the message:

fatal: Not a git repository (or any of the parent directories): .git

I've looked at all the other questions and answers on treehouse and I've researched online and I'm still missing something. What do I need to do so I can bypass that this fatal message?

5 Answers

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hi Nathan.

This is what I would do, 2 options:

1) paste here all the code step by step that you are typing so that I can have a look

2) try do the whole process in the treehouse console, this will make us understand if you are going wrong with the commands or not.

Let me know

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hello Nathan.

I did the git basics course just yesterday so let's test this out...

Also please be aware I am not much of an expert in this area (actual any area)..

First thing that comes to my mind is: are you sure you have initialized the directory? Have you run the git init myDirectoryNane command?

Nathan Brenner
Nathan Brenner
35,844 Points

Thanks Vittorio, I thought I was doing that, but somehow that works now.

Maybe you can help with the next part. I tried git commit, and I got the following message instead of what the video shows:

โ€˜C:/Program Files (x86)/Notepad++.exeโ€™ โ€“multiInst โ€“notabbar โ€“nosession โ€“noPlugin: C:/Program Files (x86)/Notepad++.exe: No such file or directory error: There was a problem with the editor โ€˜โ€™C:/Program Files (x86)/Notepad++.exe Please supply the message using either โ€“m or โ€“F option.

Do you know how to get the commit message template to open?

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

At first site I think you have not submitted this part of the command:

-m "Bla bla bla"

where bla bla bla is the message including the change and reasons for committing this.

Try: git commit -m "File edited"

and see if it works.

Let me know, I'm curious now

Nathan Brenner
Nathan Brenner
35,844 Points

[master (root-commit) f4da573] File edited 2 files changed, 2 insertions (+) create mode 100644 README.txt create mode 100644 README2.txt

Nathan Brenner
Nathan Brenner
35,844 Points

I went through the whole process again of git init my_first_repository, then git add README.txt, then git commit, and I got

On branch master changes not staged for commit: in red: deleted: README2.txt

untracked files: this is everything on ls because earlier I tried git init without file name, and I think everything on ls went into that unnamed repo.

Thoughts?