Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save necojackarc/f329fcb7a6c763c516773f8e97bf0908 to your computer and use it in GitHub Desktop.
Save necojackarc/f329fcb7a6c763c516773f8e97bf0908 to your computer and use it in GitHub Desktop.
GitHub CLI one-liner to add all repos in the organisation to a specific user or team

Conditions

# 50 is the number of repositories to be listed
gh repo list -L 50 <organisation> | \
  awk '{print $1}' | \
  while read line; \
    do yes | gh repo-collab add $line <handle> --permission {pull|triage|push|maintain|admin};
  done

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment