Skip to content

Instantly share code, notes, and snippets.

@sergirf
Created January 27, 2022 13:23
Show Gist options
  • Save sergirf/1a96fb05b3f89023fd45da06afbefee7 to your computer and use it in GitHub Desktop.
Save sergirf/1a96fb05b3f89023fd45da06afbefee7 to your computer and use it in GitHub Desktop.
run this command from the folder where all the subdirectories with git repositories are and this will create a new github repo for each one and push it all branches, commits and tags. You only have to replace ${GITHUB_ORG} for the actual name or deleted it if no ORG is needed. As a requirement it is using GitHub CLI https://cli.github.com/
for dir in *; do (cd "$dir" && git remote rm origin && gh repo create ${GITHUB_ORG}/"$dir" --private --source=. --remote=origin --push && git push --all && git push --tags); done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment