Reputation: 3931
I have a folder in my local repo called var, which sits in the root directory. As with most var folders, it's full of junk, several of which files are too large for Git to push.
I've included the following in my .gitignore
in several attempts:
var
var/
var/log/
var/log
var/
I ran:
git rm -r --cached .
git update-index
git update-index --assumed-unchanged
in various combinations with no joy! Any suggestions?
Upvotes: 2
Views: 2844
Reputation: 1441
All entries in .gitignore
prevent git from listing untracked files when you type git status
. That doesn't mean you can't add or commit them. In fact, you can.
Tracked files will stay tracked even if they get added into .gitignore
. So, in order to make them disappear from your repository, you will need to untrack them.
To do that, you need to delete them (or at least make git think so):
git rm -r --cached var
If you type git status
you will see that git now thinks you have deleted all the files in var
. Commit that. After that, git status
will tell you that you have a bunch of untracked files in var
. That is, because the files weren't actually deleted, you only made git think so. Now add the folder to your .gitignore
and they should be ignored.
Upvotes: 5