johnbumble johnbumble - 10 months ago 48
Git Question

Can't add files to Git

I am new to git and github and I am having trouble using Git. My path for Git looks something like this

C:\Program Files\Git\code_snippets
. And in the code_snippets directory I have a file. Right now what I want to do is add another file like I see people in the tutorials I am watching are doing, but nothing seems to work.

I cannot create any files in the code_snippets directory only a folder, when I try using commands like
git add index.html
I get an error saying
index.html did not match any files
. the command
git status

On branch master
Your branch is up-to-date with origin
nothing to commit, working tree clean.

Nothing I seem to do adds a file to the code_snippets directory.


For adding files using git add , you need to have the files inside the local git repository (the local git repository will have a .git folder in it).

You cannot add some files which are outside of this folder to the repo. The files in a local repo are associated to the .git folder.

If the folder is an existing one and is not tracked by git, then do a git init inside the root folder whose content you want to track. This initialises a new git repo.