A simple CLI tool to help you list and make your GitHub repositories private with ease.
-
Authenticate using a GitHub Personal Access Token
-
List all public repositories owned by you
-
Make selected repositories private via:
- Interactive selection
- Batch mode with specific repo names
- All-at-once mode
-
Supports persistent credential storage (optional)
-
Works cross-platform (Linux, macOS, Windows)
- Python 3.6+
- GitHub Personal Access Token (with
repo
scope)
-
Clone the repository:
git clone https://github.com/your-username/github-privacy-manager.git cd github-privacy-manager
-
Install required dependencies:
pip install requests python-dotenv
If you're using environment variables from
.env
, make sure you havepython-dotenv
installed.
Run the script directly using Python:
python github_privacy.py
-
--list
Only list your public repositories without making any changes. -
--batch repo1,repo2,...
Provide a comma-separated list of repository names to make private. -
--all
Make all your public repositories private. Use with caution.
-
Interactive mode (default):
python github_privacy.py
-
Batch mode:
python github_privacy.py --batch my-repo1,my-repo2
-
Make all public repositories private:
python github_privacy.py --all
-
Just list public repositories:
python github_privacy.py --list
The script will prompt you for your GitHub token and username on the first run. You can optionally choose to save them locally in a config file (~/.github_privacy_config.json
) for future runs.
Alternatively, you can set environment variables:
export GITHUB_TOKEN=your_token_here
export GITHUB_USERNAME=your_username_here
You can also use a .env
file:
GITHUB_TOKEN=your_token_here
GITHUB_USERNAME=your_username_here
- Only repositories you own will be shown and processed.
- The tool uses GitHub's REST API (v3).
- Ensure your token has the
repo
scope, or the requests to update privacy will fail.
MIT License