create-github-repo
A CLI tool to create GitHub repositories from the command line.
Installation
pip install create-github-repo
Quick Start
# Create a public repo (uses ADMIN_TOKEN from .env in the current directory)
create-github-repo my-new-repo
# With a description
create-github-repo my-new-repo -d "A cool project"
# With an explicit token
create-github-repo my-new-repo -t ghp_your_token_here
# Create a private repo
create-github-repo my-new-repo --private
Authentication
The tool resolves your GitHub token in this order:
--token/-tflag — passed directly on the command line..envfile — looks forADMIN_TOKENin a.envfile in the current working directory.
Setting up a .env file
Create a .env file in the directory where you run the command:
ADMIN_TOKEN=github_pat_xxxxxxxxxxxxxxxxxxxx
Tip: Add
.envto your.gitignoreto avoid committing secrets.
Generating a GitHub Token
- Go to GitHub → Settings → Developer settings → Fine-grained personal access tokens.
- Click Generate new token.
- Under Repository permissions, set Administration to Read and write.
- Click Generate token and copy the value into your
.envfile.
Usage
usage: create-github-repo [-h] [-d DESCRIPTION] [-t TOKEN] [--private] [-V] name
Create a GitHub repository from the command line.
positional arguments:
name Name of the GitHub repository to create (required).
options:
-h, --help show this help message and exit
-d, --description Repository description (optional). Defaults to "".
-t, --token GitHub personal access token (optional).
Falls back to ADMIN_TOKEN in a .env file in the current directory.
--private Create a private repository. Defaults to public.
-V, --version show program's version number and exit
Examples
# Minimal — just a repo name
create-github-repo awesome-project
# With description
create-github-repo awesome-project -d "My awesome project"
# Private repo with explicit token
create-github-repo secret-project --private -t ghp_abc123
Output
✅ Repository created successfully: https://github.com/youruser/awesome-project.git
On error:
❌ Validation failed (HTTP 422): name already exists on this account
Development
# Clone the repo
git clone https://github.com/ishandutta2007/create-github-repo.git
cd create-github-repo
# Install in editable mode
pip install -e .
# Run tests
pip install pytest
pytest -v
Project Structure
create-github-repo/
├── create_github_repo/
│ ├── __init__.py # Package version
│ ├── cli.py # CLI entry point (argparse)
│ ├── github_api.py # GitHub REST API interaction
│ └── token_resolver.py # Token resolution logic
├── tests/
│ ├── test_cli.py
│ ├── test_github_api.py
│ └── test_token_resolver.py
├── .github/
│ └── workflows/
│ └── publish.yml # CI/CD: test + publish to PyPI
├── pyproject.toml # Package metadata & build config
├── LICENSE # MIT License
└── README.md
License
MIT © Ishan Dutta
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file create_github_repo-0.1.0.tar.gz.
File metadata
- Download URL: create_github_repo-0.1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f575bad339bea7e14586a46bfadd24def564c1c19f1596ec4f6f81eb88f81338
|
|
| MD5 |
d9834961a02ba208cff2efd36e8f22f4
|
|
| BLAKE2b-256 |
e6c03fac6042071b616b866e46772e7d3d6a931e44cb582a9752d6c174268c38
|
File details
Details for the file create_github_repo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: create_github_repo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e1140289f80cc655dfb9a683aa69b5d9485aaf2c7ab9ac03a90f5851650df66
|
|
| MD5 |
fa9f5890cbf32974f5cb2fba17a76808
|
|
| BLAKE2b-256 |
9045fa2b6efcc0c2e86355b2e6a2f05339159769518a394c0e21c03fe114ce56
|