简体   繁体   中英

How to make git forget about a distant gitignore file?

Git is ignoring a directory that I want to track and index. I do not ignore this dir in any local gitignore file. When I inspect it, I get:

$git check-ignore -v my-ignored-dir
"I:\\path\\to\\external\\project\\.gitignore":33:my-ignored-dir/ my-ignored-dir

So the ignore instruction is coming from this external project file. The file belongs to the external project and I can't modify it. I can't find any reference to this project in my account (searching .bat files etc.).

How can I tell git to stop looking in this external file?

More generally, how does git know where to look for gitignore data and what determines the order of preference?

Thanks for the responses - these lead me to the solution:

$ git config --show-origin core.excludesFile
file:U://.gitconfig     I:\path\to\external\project/.gitignore

So this tells me that the gitignore file from the unwanted external project is defined in a file on my U: drive. I look in this file and find:

[core]
       excludesfile = I:\\path\\to\\external\\project\\.gitignore

Aha! - I worked on this project a couple of years ago. I must've ran some setup script that inserted this line into my personal .gitconfig . I zap the line and all is well...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM