I have a fork containing 2500 lfs files.
That is the entire history of the original repo.
I followed the instructions on
Hi @ccenvcvb
We don't have a feature to bulk delete the LFS files at this moment, but it's possible to delete them via the API. We do have an existing feature request on this, please Vote & Watch so that you'll get an update whenever we have any at:
While we don't have a UI feature to bulk delete the LFS files, it's possible to delete the LFS files via API, and by using the API you can create a script to bulk delete the LFS files.
I do have a script you can use, but do note that we don't officially support this script, so please use it at your own risk and tweak it as you wish.
git lfs ls-files -l | awk -F " " '{print $1}' > lfs.txt
This will print and store the LFS OID in text files of lfs.txt
git lfs ls-files -l
#!/bin/bash file="lfs.txt" credential="username:app_password" i=0 while read line || [ -n "$line" ] do i=$((i+1)) echo "File number : $i" echo "LFS Object ID (OID) : $line" cmd=$(curl -s -w "\nHTTP Code: %{http_code}\n" --user $credential -X DELETE "https://api.bitbucket.org/internal/repositories/<Workspacename>/<Repositoriesname>/lfs/$line") echo "Response : $cmd" echo "" done < $file echo "" echo "Total LFS Object ID in $file :" grep -c "" $file
I hope this helps
Cheers!
- Ben (Bitbucket Cloud Support)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.