Home > Software engineering >  Git ignores all files
Git ignores all files

Time:11-01

My gitignore file looks straighforward:

env/
.idea
*.pyc
__pycache__
*.env
/environment
db.sqlite3
*.log

When I do git add . from my root project folder and then check status - I see there is no files tracked. When I do git status --ignored, I see that all folders are ignored:

.flake8
.gitignore
.idea/
 Procfile
 env/
 requirements.txt
 runtime.txt
 src/

So it somehow ignores all the folders and files. I tried to comment everything in gitignore - and the result is the same.

I tried to reinitialize the git by:

rm -rf .git
git init

And the result is the same.

How can I add my files, without git add --force? I want files that are added in gitignore to be ignored, but still to commit other files.

CodePudding user response:

As in the comments: it seems that venv or virtualenv created a global .gitignore (in /Users/admin/.gitignore) whose second line read *, ignoring all files.

It's not clear what caused this venv entry to be created in /Users/admin in the first place, so finding out if anything depends on it remains to be done, but in the meantime, any virtual environment data in the home directory here should be moved or removed, so that the global .gitignore isn't there any more.

  • Related