The SCM tool is designed for working with GitHub organizations from the command line.
For example, you can list or remove all repositories and teams from your test organization, without having to interact manually with GitHub's web user interface.
You must be an owner of the GitHub organization to be able to access its repositories and teams with SCM tool.
Installation
SCM tool must be compiled before it can be used.
To compile the tool from the projects root folder:
make scm
Or from the cmd/scm
folder:
go install
This will compile and install the tool in your $GOPATH/bin
or $GOBIN
folder; this path should also be added to your $PATH
variable.
GitHub Access Token
To use SCM tool, you need to create a personal GitHub access token.
This is done on GitHub's web page:
-
Click your profile picture and select Settings.
-
Select Developer settings from the menu on the left.
-
Select Personal access tokens from the menu on the left.
-
Select Generate new token.
-
Name the token, e.g. QuickFeed SCM Token
.
-
Select Scopes as needed.
Currently I have enabled admin:org, admin:org_hook, admin:repo_hook, delete_repo, repo, user
, but you may be able to get away with fewer access scopes.
It depends on your needs.
-
Copy the generated token string to the GITHUB_ACCESS_TOKEN
environment variable.
You may wish to add this token to your local quickfeed-env.sh
script.
export GITHUB_ACCESS_TOKEN="your token"
Example Usage
Assuming you are an owner of the qf101
GitHub organization you can perform the several commands.
To print information about all repositories under the qf101
organization, you can run:
scm --provider github get repo -all -namespace qf101
To delete all teams under the qf101
organization, you can run:
scm delete team -all -namespace qf101
For additional examples and instructions please see the comments in cmd/scm/main.go
.