Where does the .gitignore file belong?
问题 Does the .gitignore file belong in the .git folder structure somewhere or in the main source files? 回答1: Put .gitignore in the working directory. It doesn't work if you put it in the .git (repository) directory. $ ls -1d .git* .git .gitignore 回答2: As the other answers stated, you can place .gitignore within any directory in a Git repository. However, if you need to have a private version of .gitignore , you can add the rules to .git/info/exclude file. 回答3: You can place .gitignore in any