cannot add folder to gitignore file

This question already has an answer here:

  • Ignore files that have already been committed to a Git repository [duplicate] 21 answers

  • Git doesn't ignore tracked files. You need to delete that file from the repository before it will be ignored:

    $ git rm -r Index
    $ git commit -m "Deleting 'Index' folder."
    

    This will remove the files. If you only want to remove them from the index use --cached :

    $ git rm -r --cached Index
    

    This will keep all files in the file-system and only removes them from git.


    To exclude the the Index folder, remove it and commit the changes. This is outlined in:

  • How to remove a directory in my GitHub repository?
  • That simple it is. If you only want to update the index telling git that nothing changed even it changed, use the update-index commmand:

  • https://stackoverflow.com/a/11366713/367456
  • 链接地址: http://www.djcxy.com/p/23406.html

    上一篇: .gitignore不会忽略package.json

    下一篇: 无法将文件夹添加到gitignore文件