문제

I am doing

git add db/schema.rb
The following paths are ignored by one of your .gitignore files:
db/schema.rb
Use -f if you really want to add them.
fatal: no files added

Where can I find this file is being ignored, see:

cat .gitignore
.project
nbproject
.redcar
cat ~/.gitignore
.idea

~/.gitignore is for global ignores.

도움이 되었습니까?

해결책

You can easily check what .gitignore rule is currently making your file ignored in your git repo with git check-ignore (you must have git 1.8.3.3+):

cd /path/to/your/repo
git check-ignore -v -- path/to/your/file

(The -v -- verbose -- option is important to see the rule)

다른 팁

I know it's an old question but this might help somebody.

If I want to see al my ignored files and I want to know what .gitignore is making them 'ignored' in the directory where I want to know this info, I run this command:

# Finds ignored files recursively and shows what .gitignore is ignoring them
find . -type d -exec bash -c "git check-ignore -v {}/*" \;

Another way:

# Same as before but doesn't show errors for git check-ignore
find . -type d -exec bash -c "git check-ignore -v {}/*" 2>/dev/null \;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top