Skip to content

Instantly share code, notes, and snippets.

@vinayakg
Created July 26, 2020 17:26
Show Gist options
  • Save vinayakg/45160e15c8d70e410ec1b42787481ee1 to your computer and use it in GitHub Desktop.
Save vinayakg/45160e15c8d70e410ec1b42787481ee1 to your computer and use it in GitHub Desktop.
#!/bin/sh
gituser="";
curl --user $gituser https://api.bitbucket.org/2.0/repositories/$ORGNAME\?pagelen\=20 | jq '.values[] |.links.clone[1].href' > repo.out
filename="repo.out"
while read -r line; do
name="$line"
git clone $name
reponame=$(echo $name | awk -F/ '{ print $2 }' | cut -d . -f1)
mkdir -p /tmp/$reponame
cd /tmp/$reponame
git init
hub create
git push -u origin HEAD
cd -
cd $reponame
git remote add upstream https://github.com:USER/PROJECT.git
git push upstream master
git push --tags upstream
cd -
done < "$filename"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment