Skip to content

biraderomkar/bitbucket-azuredevops-migrate

 
 

Repository files navigation

Migrate BitBucket repos to Azure DevOps

This migrates BitBucket repositories to Azure DevOps. It will clone the repo from bitbucket, modify the remote origin, and push it to Azure DevOps, therefore preserving all commit history and branches.

It will not migrate Git LFS.

Prereqs

  • curl sudo apt-get -y install curl
  • jq sudo apt-get -y install jq
  • Your git client must authenticate to BitBucket and Azure Devops using SSH

Setup .env

Fill in the variables...

Get the list of repositories from BitBucket

bash get-repos.sh

This will generate a repos.csv file containing a list of all the repository names associated with your ${BB_ORG}

Prepare the mapping

The repos.csv file will map bitbucket sources to Azure Devops projects. Column two must be the Azure Devops project name, which will be the parent for this repository.

The destination project must already exist in Azure Devops before running the next script.

The destination repository must NOT already exist in Azure Devops; It will be created during execution.

If you don't want to bring a repository over, you can just remove it's row from the CSV file.

See the sample below if you want to.

Push the repos to Azure DevOps

Once you've created the mapping, run the script

bash migrate-repos.sh

This will create the repository using Azure Devops REST API, and push the repo to Azure Devops

Did something not work right? Undo?? CTRL-Z???

If you somehow didn't get your mapping quite right, or otherwise some catastrophe happened, you can clear repos from the Azure DevOps org with the below script.

The script will delete all repos as mapped in repos.csv. You can reduce repos.csv before running this to limit the blast radius of the deletion.

The script requires an additional flag --delete to actually delete the repos. Otherwise, it will simply list the repos it's about to delete.

bash delete-repos-devops.sh

Project Sample

You can check out the repos.sample.csv for an example of what the final mapping file should look like

You can see what I cloned from BitBucket to AzureDevops

For migrating JIRA Tickets, this worked for me

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

About

Migrates BitBucket repos to Azure Devops

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Shell 100.0%