I am relatively new to python virtual environments and I recently set one up while starting a new backend project to learn django, for which I also initialized a git repo. I seemingly set up everything correctly, however, when I reopen the project I noticed that I could no longer commit changes to my git repo. I get the following error when I try git add .
:
fatal: unable to access 'C:\Users?peri/.config/git/config': Invalid argument
A few things I have noticed that are odd:
'C:/Users/vperi/Documents/Python Dev/WebDev/online_marketplace
where the project is found but instead the following address is shown in the terminal C:/Users/vperi/AppData/Local/Programs/Microsoft VS Code
.I've tried deactivating the virtual environment mentioned in point 2, changing directories to my project directory, and then trying git add .
but still get the same 'fatal' error.
I assume this has to do with git bash and my virtual environment but am new to python virtual environments so I'm pretty lost at the moment.
.gitconfig
file in C:\Users\vperi\.gitconfig
C:/Users/vperi/Documents/Python Dev/WebDev/online_marketplace
and delete any .venv
foldersI suspect that there are 2 .venv
folders so check carefully
Delete the .venv
folders
Right click on vscode (I am assuming you pinned it to taskbar and click New Window
Navigate to your project folder
After the window fully loads, open a new terminal, make sure its in the correct path. and run:
virtualenv venv
MAKE SURE YOU ARE USING POWERSHELL And run
.\venv\Scripts\activate.ps1
If this shows an error, then run this:
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ".\venv\Scripts\activate.ps1"
ctrl+comma
to open up the settings and search for
python.terminal.activateEnvironment
And set it to falseUsing git bash is not recommended unless you have a specific need to use bash-like interfaces.
Explanation:
.venv
folders, so I suggested you delete them and start from scratchpython.terminal.activateEnvironment
to false you are disabling the autoload feature of vscode that loads virtual environments