无法从Virtualenv添加/提交git

时间:2017-04-09 15:59:52

标签: python git virtualenv

我创建了一个空的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添加到其中

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

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

Error Killed: 9 after command "git add ."

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

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