Git没有添加文件

时间:2016-03-23 03:33:08

标签: git bitbucket

我正在尝试将某些文件添加到暂存区域。但是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

感谢任何帮助。感谢。

3 个答案:

答案 0 :(得分:2)

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

# 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>现在与git add -A <path>相同,所以   git add dir/会注意到您从目录中删除的路径   记录删除。在旧版本的Git中,使用了git add <path>   忽略删除。你可以说git add --ignore-removal <path>来   如果你真的想要,只添加添加或修改的路径。

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

答案 1 :(得分:1)

请改用以下内容

git add .   

git add --all  

请求answer

答案 2 :(得分:1)

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

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