1

I can commit individual files within the directory, but it will not allow me to commit the whole directory.

Daniel
  • 3,541
  • 3
  • 33
  • 46
KingDavid
  • 11
  • 3
  • The problem would be easier to diagnose if you added some minimal code reproducing the error. – jub0bs Jun 29 '14 at 17:05

1 Answers1

4

You need to be in that folder for the git commit to work.
And you need to add it first

This wouldn't work:

git init test
git add test
git commit -m "add test"

This would work:

git init test
cd test
git add .
git commit -m "add test"

You can check if the folder is part of a repo:

cd test
git rev-parse --git-dir

Make sure no environment variable like GIT_DIR is defined (which would make the git command look for a git repo elsewhere)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250