简体   繁体   English

git 添加。 不工作,但 git add filename.js 工作,为什么以及如何解决它?

[英]git add . not working, but git add filename.js works, why and how can I fix it?

Here are the results:结果如下:

When I execute git add .当我执行git add . , the terminal is not responding. ,终端没有响应。 I have to use Ctrl+C to get back.我必须使用 Ctrl+C 才能返回。

When I execute git add filename.js , it works successfully.当我执行git add filename.js ,它运行成功。 This hasn't happened before.这是以前没有发生过的。 Why and how do I fix it?为什么以及如何修复它?

➜  myproject git:(master) ✗ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

  modified:   app.js
  modified:   workers.js
  modified:   templates/index.pug
  modified:   utils.js

no changes added to commit (use "git add" and/or "git commit -a")
➜  myproject git:(master) ✗ git add . 
^C
➜  myproject git:(master) ✗ git add workers.js 
➜  myproject git:(master) ✗ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

  modified:   workers.js

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

  modified:   app.js
  modified:   templates/index.pug
  modified:   utils.js

Update:更新:

I have waited more than 3 minutes after git add .我在git add .之后等了 3 多分钟git add . , it used to be super fast. ,它曾经是超快的。

Git version: 2.17.1 Git 版本: 2.17.1

Ubuntu version: Ubuntu 版本:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:    18.04
Codename:   bionic

To debug your issue : git allows you to have more insight on what it is doing if you active some environment variables (full list in the docs ) :要调试您的问题:如果您激活一些环境变量( 文档中的完整列表) git 允许您更深入地了解它在做什么:

GIT_TRACE_PERFORMANCE=1 git add .

You can also use strace :您还可以使用strace

strace git add .
# you can dump it in a file (strace prints on stderr by default) :
sttace git add . 2> git_add.strace
# you can add timing information :
strace -tt -T git add . 2> git_add.strace

it will at least show you all the gory details on what files git add .它至少会向您显示有关git add .文件的所有详细信息git add . tries to access.尝试访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM