Git 不跟踪 virtualenv 中的更改

发布于 2025-01-17 19:05:03 字数 498 浏览 1 评论 0原文

我正在使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断爱 2025-01-24 19:05:03

听起来好像您ran virtualenv。 - 但您可能想要virtualenv venv或其他某些子目录

virtualenv with a .gitignore。代码>包含以下内容的文件:

$ cat venv/.gitignore 
# created by virtualenv automatically
*

*会导致所有内容都被忽略

删除该文件(不推荐)或在项目的子目录中制作virtualenv

it sounds like you ran virtualenv . -- but you probably want virtualenv venv or some other subdirectory

virtualenv writes a .gitignore file which contains the following contents:

$ cat venv/.gitignore 
# created by virtualenv automatically
*

that * there will cause all of the contents to be ignored

either delete that file (not recommended) or make your virtualenv in a subdirectory of your project

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文