Skip to content

Instantly share code, notes, and snippets.

@lacostej
Created January 24, 2018 13:43
Show Gist options
  • Select an option

  • Save lacostej/3917d2c278f9af4d6817f4b1b4953f6f to your computer and use it in GitHub Desktop.

Select an option

Save lacostej/3917d2c278f9af4d6817f4b1b4953f6f to your computer and use it in GitHub Desktop.
Force pruning of a bitbucket repo
# bitbucket reposize not the same as you see locally?
# run this once in a while to force GC on your bitbucket repo.
# run it BEFORE you reach your 2G limit of course.
# see https://confluence.atlassian.com/bitbucket/reduce-repository-size-321848262.html#Reducerepositorysize-Removetherepositorylimitation
git pull
touch bitbucket_should_prune_automatically
git add bitbucket_should_prune_automatically
git commit -m "But we need to force it by doing weird stuff"
git push
git reset --hard HEAD^1
git push -f
echo "Check your bitbucket repo size"
@niezbop
Copy link
Copy Markdown

niezbop commented Jan 25, 2018

The windows equivalent

@echo off
:: bitbucket reposize not the same as you see locally?
:: bitbucket reposize not the same as you see locally?
:: run this once in a while to force GC on your bitbucket repo.
:: run it BEFORE you reach your 2G limit of course.
:: see https://confluence.atlassian.com/bitbucket/reduce-repository-size-321848262.html#Reducerepositorysize-Removetherepositorylimitation
git pull
echo $null >> bitbucket_should_prune_automatically
git add bitbucket_should_prune_automatically
git commit -m "But we need to force it by doing weird stuff"
git push
git reset --hard HEAD^1
git push -f
echo "Check your bitbucket repo size"

@ndvbd
Copy link
Copy Markdown

ndvbd commented Mar 28, 2025

doesnt work anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment