Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
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

[core]

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.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...