Git 没有添加文件

Git is not adding files

我正在尝试将一些文件添加到暂存区。但是 git 没有响应。我做错了什么?

这是我查询当前状态时得到的结果

(web) roy@desktopL:~/Workspace/kpr-admin-db$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

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

        deleted:    .~lock.callLog.csv#
        modified:   db.sqlite3
        modified:   dbaccess/models.py
        modified:   dbaccess/models.pyc
        modified:   volunteers.csv

    Untracked files:
      (use "git add <file>..." to include in what will be committed)

        dbController.py

    no changes added to commit (use "git add" and/or "git commit -a")

当我尝试添加时

(web) roy@desktopL:~/Workspace/kpr-admin-db$ git add *
The following paths are ignored by one of your .gitignore files:
dbController.pyc
Use -f if you really want to add them.
fatal: no files added

感谢任何帮助。谢谢

改用以下内容

git add .   

git add --all  

参考这个answer

首先添加您必须使用的所有文件:

# add new, removed and updated files
# -A is alias for `git add . && git add -u`
git add -A .

备注

对于Git 2.0,默认为git add -A

从上面的发行说明中复制:

git add <path> is the same as git add -A <path> now, so that git add dir/ will notice paths you removed from the directory and record the removal. In older versions of Git, git add <path> used to ignore removals. You can say git add --ignore-removal <path> to add only added or modified paths in , if you really want to.


在您的情况下,您的 .gitignore 文件中有该文件,因此您必须将其从文件中删除。

如果要添加最近创建、删除和更新的文件,请使用 git add -A

注意:git add -A 不要添加 .gitignore 中提到的文件。你必须从那里删除它。