Created
April 24, 2024 17:13
-
-
Save adityapatadia/0ea8f49878ce758b59f30973d400ef91 to your computer and use it in GitHub Desktop.
Bitbucket to Github migration script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###############Shell script for migrating all repo’s reading from file################ | |
#!/bin/bash | |
name_of_github_org=yourorg | |
while IFS="" read -r p || [ -n "$p" ] | |
do | |
git clone --bare $p; | |
repo=`echo "$p" | cut -d "/" -f 2` | |
echo "Local repo created: $repo" | |
cd ${repo}.git | |
gh repo create ${name_of_github_org}/${repo} --private | |
git push --mirror [email protected]:${name_of_github_org}/${repo}.git | |
cd .. | |
done < bitbucket.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[email protected]:yourorg/repo-1 | |
[email protected]:yourorg/repo-2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps:
git clone
on Bitbucket andgit push
on Githubgh
command line: https://cli.github.com/That's it. The script will migrate all repos one by one. Tested on MacOS.