Is there any particular valid reason as to why my .gitignore
file is ignoring the fact that I have told this file to ignore all of my newly-created, previously-uncommitted files that I have included in my .gitignore
file?
Here is my setup:
#.gitingore
/hello/logging_config.py
#root
<Project>
|--hello
|---logging_config.py
|--.gitignore
Despite the fact that the logging_config.py
file is included in the .gitignore
file, it continues to keep the file with the status of untracked
.
Even when running git status
, it still returns:
Untracked files:
(use "git add <file>..." to include in what will be committed)
hello/logging_config.py
I should not be seeing this. In addition, the capital U
stays next to the filename in the Source Control panel. I fail to see why my .gitignore
file cannot tell Git to ignore the file. What am I doing wrong here?
I double checked for any typos in the spelling of the file names. Added trailing slashed, removed trailing slashed. Added leading slashes, removed leading slashes. Restarted VSC.
Ran:
git rm -r --cached .
git add .
git commit -m "Fixed untracked files"
Nothing worked.
Here is my directory tree
Update:
VSC is just returning silly, non-existent issues. I’m running the tree
command, and it does not return half the files, I run run -a
and it tells me there are no sub paths despite the fact that I can see the subfolders in the directory in the left held panel.
It is not recognising files despite spelling them correctly, it is giving me non-existent issues
Seriously, why does VSC make this so difficult? Why is this so impossible? Why is something that should be so simple be absolutely impossible? Why does this work for everyone else but not for me?
I am really getting to the end of my patience here. I just cant get anything to work! I could just scream.
13
An underscore and dot are different characters.
hello/logging_config.py
X
|---logging.config.py
5
I have just tried out exactly what you said you have. It works as expected. Therefore, you must be doing something different than you described. Why don’t you try it in a fresh project and see what you get:
mkdir fresh
cd fresh
git init
echo hello/logging_config.py > .gitignore
mkdir hello
echo whatever > hello/logging_config.py
git status
I get this; what do you get?
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
nothing added to commit but untracked files present (use "git add" to track)
PS. This is an answer, since it (hopefully) tells the OP how to solve their problem.
2