2

I accidentally commited/pushed large folders to github and am unable to push further. When trying to commit and push I receive the following message. "batch response: This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access." I would like to remove the .next folder. and I do not want to purchase more storage. I am using git bash and windows 10.

Attempts I have tried so far.

  1. Adding to .gitignore file and pushing.

  2. Following the example and solution provided here

    git filter-branch --tree-filter "rm -rf .next" --prune-empty HEAD git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d echo .next/ >> .gitignore git add .gitignore git commit -m 'Removing .next from git history' git gc git push origin master --force

  3. The solution provided Here

    git rm -r --cached myFolder

  4. The solution provided here

*CD to your local working folder and run the following command:

git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch FOLDERNAME" -- --all replace FOLDERNAME with the file or folder you wish to remove from the given git repository. Once this is done run the following commands to clean up the local repository: rm -rf .git/refs/original/ git reflog expire --expire=now --all git gc --prune=now git gc --aggressive --prune=now Now push all the changes to the remote repository: git push --all --force 

This will clean up the remote repository.*

My repository is linked below.

https://github.com/Rinzler8806/crowdCoin

I appreciate your help!

1 Answer 1

0

git itself now recommends using git-filter-repo instead of filter-branch for this purpose. Among other options for installation, you can install it just by running pip install --user git-filter-repo on Windows or brew install git-filter-repo on Mac. There is a thread about it here with more information, but in essence you can use the following command:

git filter-repo --invert-paths --path <dir> 

For whichever directory.

You can check if it worked using a command like this:

git log --all -- <dir> 

After that you should be able to add your file to your .gitignore or use git's LFS if you still want to try to commit/push it.

You may have to do this afterwards too to reconnect to remote:

git remote add origin <url> git push --force --all origin 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.