Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BFG Repo-Cleaner states my github repo is not a valid Git repository

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.

like image 220
boolean.is.null Avatar asked Jul 17 '16 18:07

boolean.is.null


People also ask

What is BFG in Git?

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.


3 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.

like image 114
Chris Avatar answered Sep 19 '22 04:09

Chris


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.

like image 40
varun vashishtha Avatar answered Sep 20 '22 04:09

varun vashishtha


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...

like image 42
Philippe Avatar answered Sep 20 '22 04:09

Philippe