A utility for transferring multiple GitHub Classroom repositories to a new owner (user or organization).
This tool was derived from jdbean/github-api-bulk-transfer, but has a slightly different behaviour:
- It combines repo names with contributors in the GitHub classroom format (
prefix-username
). - It deletes the student from the original collaborators. This is to avoid outside collaborator limits and ok for archival purposes.
- It formats the output more nicely.
THIS UTILITY IS PROVIDED WITH NO WARRANTY OF ANY SORT. USE OF THIS SOFTWARE IS DEPENDENT ON AN UNSTABLE PREVIEW API AND ITS USE COULD RESULT IN LOSS OF DATA AMONG OTHER CONSEQUENCES. USE OF THIS SOFTWARE IS EXCLUSIVELY AT YOUR OWN RISK
- Clone this repository and open up a terminal in the root directory.
- Install
bash
,curl
, &jq
and any dependencies if you don't already have them installed. - Create a GitHub Personal Access Token (Settings > Developer Settings > Personal Access Tokens > Generate new token).
Select the full
repo
scope. - Create an environment variable called
GITHUB_TOKEN
with the token you just created. - Create a file named
repos.txt
in this directory. - Create a file named
students.txt
in this directory.
-
Execute the program with the organization (
Org
), and the prefix (prefix
).bash fetch_students.sh Org prefix
-
(Optional) To write the list of students to
students.txt
directly, add> students.txt
to end of the command.
Execute the program with the organization (Org
), the repository (Repo
), and (optionally) the start date (Date
).
bash fetch_push_dates.sh Org Repo Date
-
Copy the list of GitHub usernames of your students into
students.txt
. Example:alice bob charlie ...
-
Execute the program with the old prefix including organization (
Org/OldPrefix
), and the new prefix (NewPrefix
):bash bulk_rename_repos.sh Org/OldPrefix NewPrefix
-
Copy the list of all of your assignments prefixes and paste them into
repos.txt
. Put each prefix on a new line and make sure to include the repo owner. Example:org/assignment-1 org/assignment-2 ...
-
Copy the list of GitHub usernames of your students into
students.txt
. Example:alice bob charlie ...
-
Execute the program with the name of the new owner (
NewOwner
):bash bulk_transfer_repos.sh NewOwner
All work in this repository is made available under the terms of the AGPLv3 License, a copy of which is provided in the file called License
. Copyright J.D. Bean 2019