简体   繁体   中英

Why 'git push origin master' is pushing old files to GitHub?

I am creating a GitHub pages, I already deploy the react app to GitHub pages with custom domain.

Earlier there is a file over 100MB, but when I came to know that GitHub allows only 100MB, I replaced that file with a 29MB file.

When I am pushing the new changes to GitHub master branch using " git push origin master " I am getting an error see the attached image

点击查看错误图片

The old large file is likely still part of your local Git history and as you know, the whole history of the branch is pushed.

You'll need to make sure it isn't in an earlier commit either, eg by reset ing back to a commit where the video isn't there, then committing only the new smaller one.

If you simply replaced a file that was already committed, Git will try to push the full history for that file, and that will include the old one (100MB).

Instead of filter-branch , try instead:

Install it first . ( python3 -m pip install --user git-filter-repo )

Then, for example:

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

You will the need a git push --force .

Note: do not "reset to a commit where your (large) file is not present": a commit represents a snapshot of the full repository ( all files)

By resetting to an old commit where your file is "not present", you would loose also all other new or modified files.
You need to filter your existing repository history in order to remove just that one file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM