简体   繁体   中英

Remove old committed file from git

I'm trying to change my repo from CloudForge to Github. I've done the necessary change by

$git remote set-url origin GITHUB_REPO_URL

However, as I tried to push to the new origin in Github, one of my committed files are too big for Github and got the remote error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com .

Upon consideration, I would like to remove the file from tracking and I've tried doing so

$git rm --cached PATH_TO_FILE

However, as I keep trying to push it, I keep getting the same error.

Any help is appreciated. Thanks!

Sounds like you want to remove the file permanently from your repo along with all historical references to it. It's not the easiest thing to do, and you need to be super sure you know what you're doing!

According to GitHub, this can be done with a tool called BFG.

https://help.github.com/articles/remove-sensitive-data/

https://help.github.com/articles/removing-files-from-a-repository-s-history/

bfg --strip-blobs-bigger-than 50M

I've never used that tool, though. So tread carefully.

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