Explore Courses Blog Tutorials Interview Questions
+1 vote
in DevOps and Agile by (19.4k points)

I just did a git init on the root of my new project.

Then I created a .gitignore file.

Now, when I type git status, .gitignore file appears in the list of untracked files. Why is that?

1 Answer

0 votes
by (27.5k points)

In this case, you can have a global user git .gitignore file that will apply automatically to all your repository. This will be useful for IDE and editor files (for instance, swp and *~ files for Vim). Change directory locations to suite your OS

  • Add to your ~/.gitconfig file


excludesfile = /home/username/.gitignore

You need to create a ~/.gitignore file with file patterns to be ignored

Save your dot files in another repository so you have a backup (optional).

Any time you copy, init or clone a repository your global gitignore file will be used as well.

Browse Categories