I have git repository on /var/www/html/projectx
. My goal is to tell git ignore two files /var/www/html/projectx/error.log
and /var/www/html/projectx/requsets.log
.
I try add .gitignore file
[git@x]$ cd /var/www/html/projectx
[git@x projectx]$ nano .gitignore
.gitignore :
*~
*.log
.gitignore file won't affect files that are already tracked. You can remove them with:
git rm --cached [file]
command. If you want only to ignore it locally you may try make it ignored by:
git update-index --assume-unchanged [file]
Or create explicit repository rules by editing .git/info/exclude
file inside your repository. That's good way to ignore files that you generate but don't expect other users of repository to generate. Some details can be found here.
If you have already added these files into your Git repository, .gitignore
would not have any effect until you remove them. Try:
git rm --cached error.log requsets.log
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With