【问题标题】:Unable to Add/Commit to git from Virtualenv无法从 Virtualenv 添加/提交到 git
【发布时间】:2017-09-04 15:39:03
【问题描述】:

我创建了一个空的 repo 并初始化了一个用于 Python 开发的 Virtualenv。安装所需的软件包并通过停用从虚拟环境中出来后,我无法添加/提交到 Git。

danis@Daniss-MacBook-Pro:~/Git/Sample-Repo$ git add *
Killed: 9 
danis@Daniss-MacBook-Pro:~/Git/Sample-Repo$ git add helloworld
fatal: Unable to create '/Users/danis/Git/Sample-Repo/.git/index.lock': File exists. 

Another git process seems to be running in this repository, e.g. 
an editor opened by 'git commit'. Please make sure all processes 
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

到目前为止尝试的步骤:

  • 使用命令rm -f .git/index.lock 删除了 index.lock 文件
  • 在主目录中创建 .gitignore 文件并添加 .env 到其中

【问题讨论】:

标签: python git virtualenv


【解决方案1】:

我遇到了同样的问题。它不断尝试添加".Python@ -> ..." 链接。如果您将./.Python 添加到您的.gitignore,则一切正常。如果你在别处克隆 repo,你可以将 .Python@ 链接添加到 python 安装的新位置。

【讨论】:

  • 我这样做了,但目前仍然遇到 Danis 引用的错误。
  • 您是否尝试将bin/*、include/* 和lib/* 添加到.gitignore?
【解决方案2】:

我在这里的评论中找到了答案:

Error Killed: 9 after command "git add ."

“我找到了解决方案!我已将 venv dir(我的 virtualenv)添加到 .gitignore 中,然后添加并提交所有其他文件。”

我在 virtualenv 目录中添加了 .gitignore 文件,然后删除了 .git/index.lock 文件。然后我被允许使用git add .

【讨论】:

  • 这只是让您重新运行命令并“重试” - 它不是被杀死的根本原因:9
猜你喜欢
  • 2011-10-05
  • 1970-01-01
  • 2021-12-22
  • 2015-10-14
  • 1970-01-01
  • 1970-01-01
  • 2013-04-13
  • 2023-02-09
  • 2022-10-05
相关资源
最近更新 更多