Sunday, February 7, 2021

A script to download all the repositories from a Bitbucket account


A few days ago I've to download all the git repositories from my company Bitbucket account.

I wasn't able to find any script to perform this task, so I write down this one you find in the gist linked above.

This bash script will download and eventually pull all changes from all the repositories of an account.

You can use your Bitbucket account, or better you should create a read/only account with access to all the repositories you want to download.

Set your Bitbucket account username and password in the "run_bitbucketgitdownloader.sh" file, than run the file.

$./run_bitbucketgitdownloader.sh

You also could enable the git credential helper, to prevent git always requesting you the password. This is done using the command:

$git config --global credential.helper store

If you need you could also add the file to a crontab job.


Code

Notes
  • read risk disclaimer
  • excuse my bad english