I have a git repository that is ignoring image files as well as a few other files, but my .gitignore
file only has it ignoring a config.php
file. Is there some global ignore file somewhere that I can't seem to find? I have to specify files to add them now, and it's giving me this warning:
The following paths are ignored by one of your .gitignore files.
The contents of my ~/.gitconfig
file are only my e-mail address.
Make sure the
.gitignore
file is not ignoring itself. A common mistake is adding a*
rule to the.gitignore
file to ignore every file in the current folder. The solution to this is to add an exception to.gitignore
:This way all files in the directory will be ignored, except
.gitignore
.It might be good to know that your git configuration can contain a core.excludesfile which is a path to a file with additional patterns that are ignored. You can find out if you have such a configuration by running (in the problematic git repo):
If it prints a file path, look at the contents of that file for further information.
In my case I installed git via an old version of boxen which ignored the pattern 'Icon?' that in my case gave me the warning, mentioned in this question, for a folder icons (I'm on a case insensitive filesystem that's why Icon? matches icons).
Please also check
~/.gitignore
and~/.gitignore_global
which might be created by some Git clients (e.g. Atlassian SourceTree on Mac OS X).In my case it was the forward slash in my path causing the problem...
Not Work
Work
Check you have permission to the folder. I have just run into this and it was because the folder was owned by the www-data user not the user I was logged in to the terminal as.
git check-ignore
Use
git check-ignore
command to debug your gitignore file (exclude files).For example:
The above output details about the matching pattern (if any) for each given pathname (including line).
So maybe your file extension is not ignored, but the whole directory.
The returned format is:
Or use the following command to print your
.gitignore
in user HOME and repository folder:Alternatively use
git add -f
which allows adding otherwise ignored files.See:
man gitignore
,man git-check-ignore
for more details.Syntax