Git is ignoring gitignore file under Windows 10

寵の児 提交于 2020-12-13 03:21:06

问题


Git is ignoring the folders in .gitignore file. Here is my .gitignore : (env is a folder generated by venv in Python )

#folders
env/**
pdfs/**


# files

#source files
/timeformat.py
/pdfreader.py

I already did : git rm -r --cached . then git add . but it's adding all the files under env/Lib/site-packages
What is the problem ?

EDIT :

here is my directory structure :


回答1:


Change your gitignore from

#folders
env/**
pdfs/**

to:

#folders
env/*
pdfs/*



回答2:


The reason may be the .gitignore file and env folder not present at same level in directory structure.

You can start with **/dir to ignore the dir folder inside any directory.

In your case:

**/env/



回答3:


change env/** to env /* It did the job for me



来源:https://stackoverflow.com/questions/64728721/git-is-ignoring-gitignore-file-under-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!