Created
November 2, 2020 21:22
-
-
Save Markario/d12d7e90d855497b52841c98726fbcd2 to your computer and use it in GitHub Desktop.
Backup org repos
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
#!/bin/bash | |
ORG_NAME="org name" | |
ACCESS_TOKEN="your access token" | |
GITHUB_INSTANCE="api.github.com" | |
URL="https://${GITHUB_INSTANCE}/orgs/${ORG_NAME}/repos?direction=asc&per_page=100" | |
curl -H "Authorization: token $ACCESS_TOKEN" ${URL} | ruby -rjson -e 'JSON.load(STDIN.read).each {|repo| %x[git clone --mirror #{repo["ssh_url"]} ./#{repo["name"]}/.git && cd ./#{repo["name"]} && git config --bool core.bare false && git checkout ]}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment