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
- Go to BitBucket account
- Navigate to the respective repository
- 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