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.
an alternative to git-filter-branch The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history: Removing Crazy Big Files. Removing Passwords, Credentials & other Private data.
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.
I have fixed this using the following commands:
STEP 1
cd some-big-repo.git
STEP 2
java -jar path/bfg.jar --strip-blobs-bigger-than 100M
No need to mention repo name explicitly if you are in the repo directory and it will automatically detect repo and do its job.
You should remember that with git, all you do on your history must be done locally. And, after that, published by pushing to the remote repository, once you are satisfied.
So, here you have to give the path towards your local repository...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With