Skip to content

Instantly share code, notes, and snippets.

@rastandy
Created October 18, 2022 09:28
Show Gist options
  • Save rastandy/2fa2c68172704a01f62a81595123532c to your computer and use it in GitHub Desktop.
Save rastandy/2fa2c68172704a01f62a81595123532c to your computer and use it in GitHub Desktop.
#!/bin/bash
user=$1
repo=$2
permissions=$3
echo "Adding ${user} to repo ${repo} with permissions ${permissions}..."
gh api -XPUT repos/${repo}/collaborators/${user} -f permission=${permissions}
echo "done."
#!/bin/bash
user=$1
repos_file=$2
permissions=$3
for i in `cat ${repos_file}`
do
./add-user-to-repo.sh ${user} ${i} ${permissions}
done
@rastandy
Copy link
Author

Adding a user to a Github repository with specific permissions.
Also adding a user to a list of Github repositories in a file with specific permissions.

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