CLI Application for making a GitHub repository private
This is a command-line interface (CLI) application that makes a GitHub repository private using a personal access token (PAT). The app is written in Rust programming language and uses the serde
and anyhow
crates.
- Rust programming language should be installed.
- A personal access token (PAT) with
repo
scope is required to modify the repository's privacy settings.
-
Clone this repository:
git clone https://github.com/username/repo-name.git
-
Change directory to the project's root:
cd repo-name
-
Create a
.env
file and add your PAT token in the following format:PAT_TOKEN=<your-token-here>
-
Build the project:
cargo build --release
-
Run the CLI app:
./target/release/make-private-repo
-
Enter the GitHub username and repository name when prompted.
Enter username: lloydlobo
Enter repository: gittidy
...
- Choose whether to make the repository private or not by entering either
true
orfalse
.
...
Make it private?: (true/false) true
✅ curl: exit status: 0
The app will send a PATCH request to the GitHub API with the personal access token (PAT) included in the Authorization
header.
The request payload will contain the private
field set to either true
or false
, depending on the user's input.
If the API call is successful, the repository will be made private.
For more information on how to create a personal access token (PAT), visit the GitHub documentation.
For more information on how to make a repository private using the GitHub API, visit the GitHub documentation.
This project is licensed under the terms of the [LICENSE].