Git 不跟踪 virtualenv 中的更改
我正在使用Macos Monterey 12.3。
一旦我为我的Python(Python3.9)项目初始化Git,如果我设置了Virtualenv,突然之间,Git将无法再跟踪给定目录中所做的任何更改。
要查看在同一目录中初始化git和virtualenv是否会引起任何问题,我首先创建了一个目录“ Directory_above”并在那里ran git Init
。然后,我在“ Directory_above”中创建了一个子目录“ Directory_below”,然后在子目录中设置了Virtualenv。即使不激活子目录中的VurtialNenv,GIT也无法跟踪目录中所做的任何更改。 git状态
只是给了我
没有提交
的,最近,Git开始与Virtualenv合作。
过去有没有人遇到过同样的问题?如果是这样,您是如何解决问题的?我花了一些时间来寻找同样的问题和解决方案,但是在这里找不到。
I am using MacOS Monterey 12.3.
Once I initialize git for my Python (Python3.9) project, if I set up virtualenv, all of the sudden, git can no longer track any changes made in the given directory.
To see if initializing git and virtualenv in the same directory causes any issue, I first created a directory "directory_above" and ran git init
there. Then, I created a sub directory "directory_below" in "directory_above", and I set up virtualenv in the sub directory. Even without activating vurtialnenv in the sub directory, git cannot track any changes made in the directory. git status
simply gives me
nothing to commit
As far as I remember, this kind of setup worked fine before, and recently, git started to fail to work with virtualenv.
Has anyone encountered the same issue in the past? If so, how did you solve the issue? I spent some time looking the same issue and solution, but I couldn't find it on here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来好像您ran
virtualenv。
- 但您可能想要virtualenv venv
或其他某些子目录virtualenv
with a.gitignore
。代码>包含以下内容的文件:*
会导致所有内容都被忽略删除该文件(不推荐)或在项目的子目录中制作virtualenv
it sounds like you ran
virtualenv .
-- but you probably wantvirtualenv venv
or some other subdirectoryvirtualenv
writes a.gitignore
file which contains the following contents:that
*
there will cause all of the contents to be ignoredeither delete that file (not recommended) or make your virtualenv in a subdirectory of your project