Repository templates in Bitbucket Cloud
Bitbucket Cloud has no template repositories, so every new service starts with a manual copy.
Bitbucket Cloud has no template repositories. If your team starts every service from the same skeleton, you have to copy it yourself, and the copy leaves out most of what makes a repository usable.
What a plain copy misses
Cloning an existing repository, deleting .git and pushing to a new one copies the files. It does not copy the settings that live in Bitbucket: branch restrictions, default reviewers, the merge strategy, and the pipeline variables. Someone then sets those up by hand, and each repository ends up slightly different.
A manual checklist
- Create the new repository in the right project and workspace.
- Copy the files without history, then replace names in the README,
bitbucket-pipelines.ymlandCODEOWNERS. - Recreate the branch restrictions and default reviewers from the source repository.
- Add the pipeline variables. Secured values cannot be read back, so you will need the real secrets from wherever you keep them.
- Run one pipeline to confirm the skeleton builds.
Doing it from a template
Repo Gardener for Bitbucket lets you pick any repository as a template and create new ones from it. It copies the text files, branch rules, default reviewers and settings, and creates the pipeline variables by name. Secured variables are created with the value CHANGE_ME, so the real secret never passes through the app. It fills in {{service_name}} and {{owner_team}} in the README, pipelines file and CODEOWNERS.
Templates copy up to 150 text files and 800 KB. Binary files, Git LFS files, symlinks and submodules are skipped, and the result screen tells you which ones. The archive guide covers retiring repositories you no longer use.
Questions
Does Bitbucket Cloud have repository templates?
No. GitHub has template repositories, but Bitbucket Cloud has no equivalent. Teams copy an existing repository by hand or keep a scaffolding tool such as cookiecutter.
Can I fork a repository to use it as a template?
You can, but a fork carries the full commit history and stays linked to the original. For a clean start most teams copy the files into a new repository instead.
Are branch rules and default reviewers copied when I clone?
No. Cloning and pushing copies commits only. Branch restrictions, default reviewers, repository settings and pipeline variables live in Bitbucket and have to be set again on the new repository.
What does Repo Gardener copy when it creates a repository from a template?
Text files (up to 150 files and 800 KB), branch restrictions, default reviewers, repository settings and the names of pipeline variables. Secured variables are created with the placeholder CHANGE_ME so you can fill in the real value. Binary files, Git LFS files, symlinks and submodules are skipped, and the result screen lists them.
Which placeholders does it fill in?
{{service_name}} and {{owner_team}}, in README.md, bitbucket-pipelines.yml and CODEOWNERS.