/
Bit-bucket migration from server to cloud automating script process

Bit-bucket migration from server to cloud automating script process

Step 1:

Call the Bit-bucket server API to fetch all the repositories from the server instance. Use the below API with admin credentials to fetch the repositories, git clone url's, repository names, project names.

API: http://bitbucket.{yourInstance}.com:7990/rest/api/1.0/repos

Method: GET

Authentication: Your admin credentials

Step 2:

Using the git clone url’s clone the repository to the local using git command. Use the below command to clone.

Command: git clone <"cloneURL"> --bare

Step 3:

Using project names from the fetched response create projects with same name in Jira cloud by calling Jira cloud API. Use the below API with admin credentials to create projects in cloud.

API: /2.0/teams/{username}/projects/

Method: POST

Authentication: Your admin credentials

Note: Username or an account is either a team or user.

Step 4:

Using the repository names call the Bit-bucket cloud API to create repositories in cloud. Use the below API with admin credentials to create repositories in cloud.

API: /2.0/repositories/{workspace}/{repo_slug}

Method: POST

Authentication: Your admin credentials

Note: Workspace is UUID of the instance.

Step 5:

Using the git command push the locally cloned repositories to Jira cloud. Use the below commands to push to repo.

Commands:

git remote add origin <"CloneURL_for_Cloud">

git push --all

Note: Need to verify the commands properly