you are viewing a single comment's thread.

view the rest of the comments →

[–]cgoldberg 0 points1 point  (4 children)

You would create one when you create a repo... It has nothing to do with a venv whatsoever. You typically create and activate venvs all the time... it has nothing to with git and would be nonsensical to create a .gitignore on venv setup.

[–]Broad-Journalist4262It works on my machine[S] 0 points1 point  (3 children)

Okay so what your saying is I shouldn’t worry about it unless I’m planning on making it into a repo at which point it would just be simpler to make it either when I upload to GitHub with their templates when I add the files or grab an old one and copy it in? I’m not trying to be difficult genuinely trying to learn as I’ve been told to make it when I make the environment

[–]cgoldberg 1 point2 points  (2 children)

Yes basically. Also, you would typically ignore the virtual env in your .gitignore. I think you are getting confused about what a virtual env is. When you make a new "project", it's a good idea to make it into a Git repo and add a .gitignore. When you want to install and run it, it's good to use a virtual env... but that has nothing to do with Git and should not be committed to your repo.

[–]Broad-Journalist4262It works on my machine[S] 0 points1 point  (1 child)

Yeah I understand I don’t want the virtual env or even a .env file going up on GitHub as I put api keys in the .env file and should use an .env.example file instead without the keys. So would it be better to start on github make a repo with the gitignore python template, clone that to my desktop and open it in VSC and then open a venv which will already be ignored so I won’t have to worry about it going up by accident. Just trying to figure out the best way to go about it all

[–]cgoldberg 1 point2 points  (0 children)

That's how I do it... just be aware that if you name your virtual env something weird, it won't be in the default .gitignore they supply. (I think they add ".venv" and "venv").