Unable to exclude Virtual Environments from GitHub synchronization/version control.
One is supposed to exclude the Virtual Environments from virtual control because virtual environment can be re-created using the requirements.txt file. However, when a new project/solution/virtual environment is created, Visual Studio can show any of the following behaviors:
- It may show all uncommitted files/folders in the project/solution in Git Changes window, but when you right-click the virtual environment window, it may not show the "Exclude these local files" option.
- It may not show the virtual environment folder in the Git Changes window, while showing other files & folders which are yet to be committed.
- It may not show any files/folders in the Git Changes window, even when there exist uncommitted files/folders.
Now, what I did last time (on 6th June 2022 when I first created the AirportDecisionSupportSystem solution) was:
- Go to the .gitignore file and append to it the relative path of the virtual environment folder (/env).
- Following the leads in this article, I opened a Terminal window (Developer Powershell) in Visual Studio and ran the command git reset . (without any special admin privileges).
Now, when I opened the Git Changes window in Visual Studio, it gave showed all uncommitted files and folders, including the virtual environment one. Also, when I right-clicked on the virtual environment folder now, I was shown the "Exclude these local files" option.
Comments
Post a Comment