1

I accidentally uploaded some unnecessary files to my git repo. Somehow I deleted all the unnecessary files from the local repo and pushed all the changes forcefully to GitHub, and it worked and all files are completely gone.

However I am facing a strange issue, when I download the git repo through GitHub page using download button the:

size of my repo is 500kbs

When I clone the repo through git clone, terminal output shows:

it dowloaded  around 130MB

However, at the end, after download completes (this size seems ok after unzipping the 500kb file):

git repo size is around  1.3MB.

When I check the property of the directory though UI:

it shows 1.3MB

When I try to check the property through command prompt(du -sh /Dir):

it shows size 130MB 

I try to explore a bit more then I found that .git/object has the missing big chunk around 130MB. 

I am trying to understand what the problem is, and how I can resolve the issue. 

Thank you.

jax
  • 3,927
  • 7
  • 41
  • 70
  • Did you use `git filter-branch` or `git filter-repo` to delete the unnecessary files from all the commits? If not, the file data are still referred to by the old commits and exist in the git database. – ElpieKay Jun 12 '20 at 02:47

1 Answers1

0

I would first check the result of a purge of the history of your repository: use the new tool git filter-repo which replaces BFG and git filter-branch.

git filter-repo --strip-blobs-bigger-than 10M

Check the size of the .git folder then.
Make sure those large files were not needed in your repo history.

Note: if you get the following error message when running the above-mentioned commands:

Error: need a version of `git` whose `diff-tree` command has the `--combined-all-paths` option`

it means you have to update git.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250