Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshjohanning/e7ae1abfefd74d7f9e5f915d42929d47 to your computer and use it in GitHub Desktop.
Save joshjohanning/e7ae1abfefd74d7f9e5f915d42929d47 to your computer and use it in GitHub Desktop.
Update the repo visibility for all repos in a github org from internal to private
ORG_NAME="joshjohanning-org"
# get a list of internal repos in my github org
repos=$(gh api "/orgs/$ORG_NAME/repos" -q '.[] | select(.visibility == "internal") | .name' --paginate)
# loop through repos
for repo in $repos; do
echo "Changing visiblity to internal: $ORG_NAME/$repo"
echo "Changing visiblity to internal: $ORG_NAME/$repo" >> change-repo-visiblity.log
gh repo edit $ORG_NAME/$repo --visibility private
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment