Answer a question

This is a follow-up question from a previous question on Stackoverflow.

I've tried to remove large files from my local git history, but the tool (BFG Repo-Cleaner) suggested in this question states that my private GitHub repository is not a valid git repository.

The command I use is:

java -jar bfg-1.12.12.jar  --strip-blobs-bigger-than 99M https://github.com/name/repo.git

Which eventually results in:

Aborting : https://github.com/name/repo.git is not a valid Git repository.

I couldn't find a solution. Is the tool not compatible with private or https GitHub repositories? How would I use the alternative tool git-filter-branch, to remove all files larger than 99MB from my local git history?

The project is about 6MB large and only about 50 commits were made up to now and no other people are working on it.

Answers

Point to a local copy, not a remote.

You have given your GitHub URL to the tool, but the usage section on their site says that you should work from a local copy of your repository:

Usage

First clone a fresh copy of your repo, using the --mirror flag:

$ git clone --mirror git://example.com/some-big-repo.git

This is a bare repo, which means your normal files won't be visible, but it is a full copy of the Git database of your repository, and at this point you should make a backup of it to ensure you don't lose anything.

Now you can run the BFG to clean your repository up:

$ java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git

There is lots of other good content on that page; I recommend you read the entire thing before trying again.

Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐