Intellipaat Back

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

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...