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
Release files for create-github-repo 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| create_github_repo-0.1.0.tar.gz | 7.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| create_github_repo-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.0 kB
Release files / create_github_repo-0.1.0.tar.gz
| Download URL | create_github_repo-0.1.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f575bad339bea7e14586a46bfadd24def564c1c19f1596ec4f6f81eb88f81338
|
|
BLAKE2b-256 checksum How to use checksums |
e6c03fac6042071b616b866e46772e7d3d6a931e44cb582a9752d6c174268c38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / create_github_repo-0.1.0-py3-none-any.whl
| Download URL | create_github_repo-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e1140289f80cc655dfb9a683aa69b5d9485aaf2c7ab9ac03a90f5851650df66
|
|
BLAKE2b-256 checksum How to use checksums |
9045fa2b6efcc0c2e86355b2e6a2f05339159769518a394c0e21c03fe114ce56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|