The direct reason for the error is that yes, it's impossible to use git-add
with a bare repository. A bare repository, by definition, has no work tree. git-add
takes files from the work tree and adds them to the index, in preparation for committing.
You may need to put a bit of thought into your setup here, though. GIT_DIR is the repository directory used for all git commands. Are you really trying to create a single repository for everything you track, maybe things all over your system? A git repository by nature tracks the contents of a single directory. You'll need to set GIT_WORK_TREE
to a path containing everything you want to track, and then you'll need a .gitignore
to block out everything you're not interested in tracking.
Maybe you're trying to create a repository which will track just c:\www
? Then you should put it in c:\www
(don't set GIT_DIR). This is the normal usage of git, with the repository in the .git directory of the top-level directory of your "module".
Unless you have a really good reason, I'd recommend sticking with the way git likes to work. If you have several things to track, you probably want several repositories!