.gitignore for virtualenv
12 ignore rules for virtualenv, ready to copy into your repository.
Python virtual environment tool
The complete .gitignore for virtualenv
# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-09-17 17:41:05 UTC
# Technologies: virtualenv
### virtualenv ###
.venv/
# Virtual environment directory
venv/
.python-version
# Python version marker
.Python
[Bb]in
[Ii]nclude
pyvenv.cfg
[Ll]ib
[Ll]ib64
pip-selfcheck.json
[Ll]ocal
[Ss]cripts
What these virtualenv rules actually ignore
Every pattern below, and why it belongs in your .gitignore.
General
| Pattern | What it ignores |
|---|---|
.venv/ |
Virtualenv https://realpython.com/python-virtual-environments-a-primer/#the-virtualenv-project |
venv/ |
Virtual environment directory |
.python-version |
General |
pyvenv.cfg |
General |
pip-selfcheck.json |
General |
Custom python interpreter
| Pattern | What it ignores |
|---|---|
.Python |
Python version marker |
[Bb]in |
Custom python interpreter |
[Ii]nclude |
Custom python interpreter |
[Ll]ib |
Custom python interpreter |
[Ll]ib64 |
Custom python interpreter |
[Ll]ocal |
Custom python interpreter |
[Ss]cripts |
Custom python interpreter |
How to use this .gitignore for virtualenv
- Copy the virtualenv rules above, or download the file directly.
- Create a file named .gitignore at the root of your Git repository and paste the rules into it.
- If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
- Commit the .gitignore so everyone on the team shares the same rules.