Hi,
I have a repository named "attachmentparenting.d8.org" and there is a folder called "audio" that I need to remove. It contains lots of big mp3 files and they were committed mistakenly.
I need to decrease the repository size, once I tried to delete the large file from another repository but end up losing some data and I don't want to take any risk this time.
anyone can help me to achieve this without any issue?
Thanks in advance,
Sunny
Hi @sunny386
If I got this correct you wish to delete the "Audio" folder in your repositories and do not wish to break or lose any other data on your repositories?
If yes, can you follow these steps to delete the "Audio" folder from your repositories:
git clone --mirror https://bitbucket.org/<workspace>/<reponame>
java -jar bfg-1.14.0.jar --delete-folders <foldername> <reponame>
Folder name = Folder name you want to deletecd <reponame>
git reflog expire --expire=now --all && git gc --prune=now --aggressive
Additional note, it's best to create a new folder and clone the bare repositories in it and put the BFG in the new folder. This is to avoid mistakenly deleting duplicate non-bare repositories.
I hope this helps, please let me know if you have any questions.
Cheers,
Syahrul
Hi @Syahrul Thank you for the response,
I have followed all the steps given but somehow while pushing it gives this error.
"error: RPC failed; curl 55 OpenSSL SSL_write: Connection was aborted, errno 10053
fatal: the remote end hung up unexpectedly
Writing objects: 100% (19810/19810), 1.68 GiB | 575.00 KiB/s, done.
Total 19810 (delta 4262), reused 4262 (delta 4262), pack-reused 15548
fatal: the remote end hung up unexpectedly
Everything up-to-date"
Is it because of my internet connection and the repo size is big? if you run the git GC now will it help me to reduce the space and remove the audio folder? the audio folder is still showing in the repo and the size is also the same.
Please suggest anything that works for me.
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @sunny386
Before pushing can you run "git count-objects -vH" inside the repo, if the size is less than 1.8GB then the files are properly deleted and you may need to use "git push -f" to force the push.
I did run a GC on the affected repositories, but the size still remains at 1.8GB so I believe the latest push did not go through, could you try again with the force option?
If it's still failing could you restart the steps again and share with me the output of each command? I wish to verify if there are any failed steps that may affect the removal of the folders.
I look forward to hearing from you.
Cheers,
Syahrul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Syahrul , This command (git count-objects -vH) is showing the same size (size-pack: 1.74 GiB)
Please check the below screenshot of every step that I followed again on the folder that I copied before running any command.
It seems like the git push isn't working again. I tried with -f too but no luck.
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @sunny386
Thanks for the update. It looks like your second force push did the work since running an aggressive GC on the affected repositories reduced the repositories size accordingly.
Can you check and confirm this with me and let me know if the size is still showing large or if the files still exist in the remote repositories.
I look forward to hearing from you
Cheers,
Syahrul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.