November 26, 2021

BitBucket to GitHub Repo Migration including history

Hi all,

In this blog, we are going to achieve how we can move/copy the bitbucket repo to GitHub.

Checkout BitBucket Repo

git clone https://USER@bitbucket.org/USER/PROJECT.git

Add GitHub repo as upstream

cd project-folder git remote add upstream https://github.com:USER/PROJECT.git

Note: To get the already assigned upstreams, use the below command
git remote -v 

Push the branch(es)

git push upstream master git push --tags upstream

On push unsuccessful, try the below to have same history

git checkout upstreambranch git branch main upstreambranch -f git checkout main git push origin main -f

Add redirect URL

git remote set-url origin git@github.com:USER/PROJECT.git

Clean up the BitBucket (old) repo [Optional]

Verify the content carefully on the GitHub repo

  1. Go to BitBucket account
  2. Navigate to the respective repository
  3. Click Settings -> Delete repository

Hope this helps you to organize the repositories as per your choice to serve the best way for dev and ops.

Please send your feedback and comments to psrdotcom@gmail.com

No comments:

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com