+1 vote
1 view
in DevOps and Agile by (30k points)
edited by

My .gitignore file seems to be being ignored by Git - could the .gitignore file be corrupt? Which file format, locale or culture does Git expect?

My .gitignore:

# This is a comment



The output from git status:

# On branch master

# Your branch is ahead of 'origin/master' by 1 commit.


# Untracked files:

#   (use "git add <file>..." to include in what will be committed)


#       debug.log

#       nbproject/

nothing added to commit but untracked files present (use "git add" to track)

I would like debug.log and nbproject/ not to appear in the untracked files list.

Where should I start looking to fix this?

1 Answer

0 votes
by (51.2k points)
edited by

As your files are not tracked yet, so git is not aware of your files so .gitignore is ignored  by git for that first add the files to .gitignore

For adding to .gitignore run the following commands 

git rm -r --cached .

git add .

git commit -m "fixed untracked files"

 Note: commit your changes or else it will be lost.

For more information please go through the following tutorial to get more info about git:

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