A simple cross-platform CLI to clone and update repositories from a Bitbucket
workspace (Cloud) or project (Server/Data Center). It stores configuration and
incremental sync metadata in a single .env file and is designed for simple,
incremental repository synchronization.
- Supports Bitbucket Cloud and Bitbucket Server / Data Center.
- Auth via Git Credential Manager (App Password / PAT prompt on first use).
- Creates or updates
.envautomatically; exits if required values are missing. INSECURE=trueby default (skips TLS verification) for frictionless setup.- Supports corporate CA PEMs when
INSECURE=false. - Incremental metadata written to
.envper-repo: DEFAULT_BRANCH, LAST_SYNC, LAST_STATUS, LAST_COMMIT, ACTIVE_BRANCH.
Repository URLs are stored in REPO_LIST as one URL per line (not comma-separated).
Example:
REPO_LIST=https://bitbucket.org/workspace/repo1
https://bitbucket.org/workspace/repo2- Python 3.9+
- Git installed and available in PATH
- Python packages:
requests(runtime) andpyinstaller(optional, for builds)
Install runtime deps:
pip install requests- First run to create a
.envtemplate:
python bb_sync.py- Fill the
.envwith required fields (examples below). IfREPO_LISTis empty the tool will attempt to sync all repositories in the workspace/project.
Example .env (Server/DC auto-detection):
BITBUCKET_USER=your.user
BITBUCKET_WORKSPACE=https://bitbucket.example.com/projects/PROJ
BB_BASE_DIR=/home/you/workspaces
REPO_LIST=
INSECURE=true
BITBUCKET_CA_BUNDLE=
GIT_CA_BUNDLE=
# Bitbucket Workspace Sync Tool
[](https://github.com/ramongranda/bitbucket-env-sync/actions/workflows/build.yml)
[](https://github.com/ramongranda/bitbucket-env-sync/actions/workflows/release.yml)
[](LICENSE)
A simple cross-platform CLI to clone and update repositories from a Bitbucket
workspace (Cloud) or project (Server/Data Center). It stores configuration and
incremental sync metadata in a single `.env` file and is designed for simple,
incremental repository synchronization.
## Features
* Supports Bitbucket Cloud and Bitbucket Server / Data Center.
* Auth via Git Credential Manager (App Password / PAT prompt on first use).
* Creates or updates `.env` automatically; exits if required values are missing.
* `INSECURE=true` by default (skips TLS verification) for frictionless setup.
* Supports corporate CA PEMs when `INSECURE=false`.
* Incremental metadata written to `.env` per-repo: DEFAULT_BRANCH, LAST_SYNC,
LAST_STATUS, LAST_COMMIT, ACTIVE_BRANCH.
## REPO_LIST format
Repository URLs are stored in `REPO_LIST` as one URL per line (not comma-separated).
Example:
```env
REPO_LIST=https://bitbucket.org/workspace/repo1
https://bitbucket.org/workspace/repo2- Python 3.9+
- Git installed and available in PATH
- Python packages:
requests(runtime) andpyinstaller(optional, for builds)
Install runtime deps:
pip install requests- First run to create a
.envtemplate:
python bb_sync.py- Fill the
.envwith required fields (examples below). IfREPO_LISTis empty the tool will attempt to sync all repositories in the workspace/project.
Example .env (Server/DC auto-detection):
BITBUCKET_USER=your.user
BITBUCKET_WORKSPACE=https://bitbucket.example.com/projects/PROJ
BB_BASE_DIR=/home/you/workspaces
REPO_LIST=
INSECURE=true
BITBUCKET_CA_BUNDLE=
GIT_CA_BUNDLE=Example .env (Cloud):
BITBUCKET_USER=myuser
BITBUCKET_WORKSPACE=my-workspace
BB_BASE_DIR=/home/myuser/workspaces
REPO_LIST=
INSECURE=trueSet AUTO_COMMIT_ENV=true in .env to opt in. When enabled the tool will
attempt to git add .env and git commit -m "env: update <slug> <timestamp>"
in the repository root after each successful per-repo update. Failures are
logged but do not stop the sync.
WARNING: do NOT store secrets, PATs or credentials in .env if you enable
this option. Prefer a separate non-sensitive metadata file if you need
versioning.
Windows:
pyinstaller --onefile --name bb_sync bb_sync.pyLinux:
pyinstaller --onefile --name bb_sync_linux bb_sync.pyArtifacts will appear in dist/.
The repository includes GitHub Actions workflows to build Windows and Linux
binaries and to attach them to releases. The build workflow triggers on pushes
to the master branch and on pull requests. Releases are produced from git tags
(v*).
Install developer tools:
pip install pre-commit black isort flake8
pre-commit installRun checks locally:
pre-commit run --all-files
black . && isort .
flake8| Command | Description |
|---|---|
make install |
Install dependencies |
make build-win |
Build Windows binary |
make build-linux |
Build Linux binary |
make build-all |
Build both |
make zip |
Create deployable zip bundle |
Get the latest binaries:
This project is licensed under the MIT License. See the LICENSE file for the
full text.
Ramón Granda — Zoomiit · Asturias, Spain