Migrate from Bitbucket
Last updated:
Codebahn imports Bitbucket Cloud repositories over Git: commits, branches, and tags, with full history. You can import once, or keep a read-only mirror in sync while you work on Bitbucket. Bitbucket Pipelines does not run on Codebahn, so pipelines need a rewrite (see CI workflows).
Prerequisites
Section titled “Prerequisites”- A Codebahn account on a paid plan, Solo or Crew (see getting started)
- Access to the Bitbucket repositories you want to migrate
- Git installed locally (for pointing your clone at the new remote afterward)
What gets imported
Section titled “What gets imported”| Bitbucket | Codebahn |
|---|---|
| Commits, branches, tags | Imported |
| Pull requests and comments | Not imported |
| Issues and wikis | Not imported |
| Pipelines and their variables | Not imported; see CI workflows |
| Workspace members and permissions | Not imported; invite your team |
Merge open pull requests before the import, or open them again on Codebahn from the imported branches.
Create a Bitbucket token
Section titled “Create a Bitbucket token”Public repositories need no token: leave the username and password empty. For private ones, create an API token, which covers every repository your Bitbucket account can read:
-
In Bitbucket, open your profile menu > Account settings > Security
-
Click Create and manage API tokens > Create API token with scopes. Git access requires a token with scopes
-
Set a name and an expiry date, and click Next
-
Select Bitbucket as the app, and click Next
-
Search for
read:repository:bitbucket, tick its checkbox, and click Next -
Click Create token and copy the value. It is shown once
On Codebahn you enter this token as a password. The username depends on the type of token:
| Token | Username | Password |
|---|---|---|
| API token | x-bitbucket-api-token-auth | The token |
| Repository access token | x-token-auth | The token |
A repository access token limits access to one repository. Create it in the repository’s settings, under Security > Access tokens, with Read under Repositories.
Option A: one-time import
Section titled “Option A: one-time import”-
Log in to Codebahn
-
Click + > Import repository > Git
-
In Clone URL, enter the HTTPS URL without a username:
https://bitbucket.org/your-workspace/your-repo.git. The URL that Bitbucket’s Clone button gives you may contain your username before the@; remove it -
For a private repository, enter the username and password from the table above
-
Leave This repository will be a mirror unchecked
-
Choose the owner (your account or an organization) and confirm the repository name
-
Click Import repository
After it completes, the Codebahn repository is independent from Bitbucket. Revoke the token when you have imported everything.
Option B: mirror first
Section titled “Option B: mirror first”A mirror is a read-only copy that pulls from Bitbucket on a schedule. Your team keeps pushing to Bitbucket, and you switch one repository at a time.
Follow the steps in Option A, but check This repository will be a mirror. Then set how often it syncs:
-
Go to Settings > Repository on the mirror repo
-
Under Mirror Settings, set the interval. The default is eight hours and the minimum is ten minutes. Codebahn checks for due mirrors every ten minutes, so a sync can start up to ten minutes after the interval ends
-
Click Save
You cannot push to a mirror, and CI does not run on it. Syncs stop when the token expires, so note its expiry date and enter a new token in Mirror Settings before then.
When you are ready to switch, stop pushing to Bitbucket, click Synchronize Now, and wait for the sync to finish. Then use Danger Zone > Convert to regular repository. The conversion is permanent, and later commits on Bitbucket will not arrive.
Migrate several repos
Section titled “Migrate several repos”Repeat the import or mirror steps for each repository. One API token works for all of them.
Manual fallback
Section titled “Manual fallback”Create an empty repository on Codebahn, then clone and push by hand:
git clone --bare https://bitbucket.org/your-workspace/your-repo.gitcd your-repo.gitgit push --mirror git@codebahn.net:your-org/your-repo.gitAfter import
Section titled “After import”Point your local clone at Codebahn:
git remote set-url origin git@codebahn.net:your-org/your-repo.gitAdd your SSH key first under Settings > SSH / GPG Keys if you haven’t.
CI workflows
Section titled “CI workflows”A starting map:
| Bitbucket Pipelines | Actions |
|---|---|
bitbucket-pipelines.yml | .github/workflows/*.yml |
default | on: push with a branches filter. Plain on: push also runs on tags, which default does not |
branches | on: push with branches |
pull-requests | on: pull_request |
step | A job. Pipelines runs steps in order; Actions runs jobs in parallel unless you add needs |
parallel | Jobs without needs between them |
script | steps with run |
after-script | A step with if: always() |
image | container |
caches | actions/cache |
artifacts | actions/upload-artifact / actions/download-artifact. Later Pipelines steps download artifacts automatically; Actions jobs must download them |
services | services at job level |
| Variables and secured variables | Variables and secrets, entered again on Codebahn |
| Pipes | No direct equivalent. Use an action or run |
Pipelines clones the repository at the start of every step. Actions does not clone automatically: add actions/checkout to every job that needs the code.
GitHub’s Actions Importer converts Bitbucket Pipelines to GitHub workflows, and its dry-run command lets you preview the result. We have not tested its output on Codebahn. Port one pipeline at a time, starting with the simplest, and verify each before moving on. See set up CI for a working example and CI compatibility for what is supported.
Troubleshooting
Section titled “Troubleshooting”“The URL contains credentials”
The clone URL includes a username, such as https://you@bitbucket.org/.... Remove everything between https:// and bitbucket.org, and use the username and password fields.
The clone URL starts with https://ssh.bitbucket.org
You pasted an SSH URL (Bitbucket uses ssh.bitbucket.org for SSH), and Codebahn converted it to HTTPS with the SSH hostname. Change ssh.bitbucket.org to bitbucket.org. Otherwise the import fails after about two minutes with “Failed to connect to ssh.bitbucket.org port 443”.
“Authentication failed” Bitbucket returns the same error for a wrong username, a wrong token, and a repository that does not exist. Check that:
- the username matches the token type
- the token was created with scopes, for the Bitbucket app, and has not expired
- the workspace and repository in the URL are correct, and your Bitbucket account can read them
- a public repository has empty username and password fields, because wrong credentials fail there too
If you use an app password, replace it with an API token; Atlassian has disabled app passwords.
Mirror syncs stopped The token probably expired or was revoked. Enter a new one in Settings > Repository > Mirror Settings.
You can leave any time
Section titled “You can leave any time”What you import, you can take back out. Org Settings > Export produces a tar.gz with every repo’s full Git history plus issues, pull requests, labels, milestones, and releases.

