If you are receiving the error message like below when you are trying to add a file into git repository -
This means, .gitignore file is active in your shell environment and working as expected. The problem arise when you have enabled multiple .gitignore files active and you have to alter the file which is actually ignoring this particular file (a.log in our case).> git add a.logThe following paths are ignored by one of your .gitignore files:a.loghint: Use -f if you really want to add them.hint: Disable this message with "git config advice.addIgnoredFile false"
Git provides a very straight forward command to check which file and rules are actually ignoring the file, which is git check-ignore -v FILE
Let's see, how to use that command and make sense of output printed -
Here, the First part (/Users/Atul/.oma_gitignore_global) is the file name which is ignoring the file.> git check-ignore -v a.log/Users/Atul/.oma_gitignore_global:25:*.log a.log
Second part (25) is the line no in gitignore file which has the ignore rule (*.log), which you can check as below -
> head -25 /Users/Atul/.oma_gitignore_global | tail h*.log
and the Last part (a.log) is the name of file which is being ignored. If that's a mistake, you now know which is ignoring the file, edit that as per your requirement.
Happy Learning !!
Like the below page to get the update
Facebook Page Facebook Group Twitter Feed Telegram Group
No comments:
Post a Comment