Skip to content

Instantly share code, notes, and snippets.

@joemaffia
Last active November 13, 2022 12:50
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save joemaffia/bacf72580d425c8eee67ec68708a4124 to your computer and use it in GitHub Desktop.
Save joemaffia/bacf72580d425c8eee67ec68708a4124 to your computer and use it in GitHub Desktop.
Clear git cache
git rm -r --cached .
git add .
git commit -m 'git cache cleared'
git push
@Jbaker8390
Copy link

awesome, this is perfect.

@mdivk
Copy link

mdivk commented Feb 6, 2018

In my earlier push I was aware of the big file size limit, and now despite I've decreased the big file's size, I still cannot make a push like usual (I tried your code above with no use), here is the output:

remote: error: Trace: cbe47...........ed7f
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File logs/access.log is 114.38MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/mdivk/cca175.git
![remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://github.com/mdivk/cca172.git'

I already deleted the errored file logs/access.log from GitHub and Local
And then I ran git rm -r --cached .

After these I ran git push and errored out.

It would be appreciated if you can help sort it out. Thank you very much.

@sni10
Copy link

sni10 commented Mar 21, 2018

git commit -am 'git cache cleared'

fatal: Paths with -a does not make sense.

@LucasBarbosa88
Copy link

is just -m

@renishpaystudio
Copy link

Here is the clear GIT cache for a specific file.

git rm --cached database.php
git add --all
git commit -m "Remove the database config file cache"
git push origin branch_name

You can read more about git clear cache for the specific files you can check it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment