syntaxvirtualenvgitignore

.gitignore syntax - how to exclude virtualenv sub-directories?


I have a couple different virtual environments in a project, e.g.

~/project_dir/sub_dirs/venv/...

Adding */venv/* to the .gitignore file does not prevent the virtual environment folders and their contents from being excluded. What is the correct syntax to prevent these virtual environment directories from being added to the git repository?


Solution

  • per https://github.com/github/gitignore/blob/master/Python.gitignore

    venv/ does the trick for sub-directories.