Exclude folder from github

前端 未结 4 744
失恋的感觉
失恋的感觉 2021-02-02 10:43

I need to exclude the folder App_Data from my Github but i don\'t know how.

I have a application which saves many files like jpg files in the directory: Source\\MyProjec

相关标签:
4条回答
  • 2021-02-02 10:58

    Per https://help.github.com/articles/ignoring-files

    From time to time there are files you don't want git to track. There are a few methods of telling git what files to ignore.

    If you create a file in your repository named .gitignore git will use its rules when looking at files to commit. Note that git will not ignore a file that was already tracked before a rule was added to this file to ignore it. In such a case the file must be un-tracked, usually with git rm --cached filename

    This file can be committed into the repository, thus sharing the rule list with any other users that clone the repository.

    0 讨论(0)
  • 2021-02-02 11:01
    1. Create a file called .gitignore in your repository.
    2. Add the text "App_Data" to this file.
    3. Save.

    It should do exactly what you want. It will exclude files/folders with that string from your local repository path (the path where .gitignore is stored).

    Keep in mind, this is not your only option. I'd read the help document linked below for a better understanding to get exactly what you need accomplished.

    See here for more info: GitHub Help - Ignoring Files

    0 讨论(0)
  • 2021-02-02 11:09

    Simply put this in your .gitignore file (assuming MyProject is your git root):

    App_data
    
    0 讨论(0)
  • 2021-02-02 11:10

    In case you need to ignore a whole folder which was already tracked, do not forget to do it recursively with -r.

    1. Add foldername/ to .gitignore

    2. git rm -r --cached foldername/

    0 讨论(0)
提交回复
热议问题