Git add not working for folder with .git folder

Git add not working for folder with .git folder

Also you might get something like
fatal: Pathspec ‘’ is in submodule ‘some/folder/name’
Also you might notice, if you commit and pushed, only some skeleton of the of the folder structure without the actual files would be committed.

The root of the problem is the folder you are trying to add is tracked under git itself.
This would confuse git and would rather leave it up to you.

the fix
First go ahead and remove the .git folder in the new directory

sudo rm -rf /path/to/new/folder/.git

Then clear the cache from git memory of the new folder

git rm -r --cache /path/to/new/folder

Then when you do the

git status

you will see all the new files being listed and you can commit that.

See changes in Git after staging change

Updating Git on Mac showing previous version

symfony production path not working but works on dev environment

Leave a Reply

Your email address will not be published. Required fields are marked *