CLI tool for creating and initializing GitHub repositories from the terminal.
Project description
ghinit
ghinit is a Python CLI for creating GitHub repositories and bootstrapping the
current directory without leaving the terminal.
It wraps gh and git, adds interactive prompts with sensible defaults, and
can scaffold a starter project template before the first push.
Why ghinit
- Create a GitHub repo from the terminal with one command.
- Avoid the repeated
git init,git add,git commit, remote setup, and push flow. - Reuse starter templates for APIs, CLIs, frontends, and ML projects.
- Keep defaults in
~/.ghinit.tomlso repeated setup takes less time.
Requirements
- Python 3.8+
gitghauthenticated withgh auth login
Install
From PyPI:
pip install ghinit
For local development:
pip install -e ".[dev]"
If your shell does not find the installed repo command, add:
export PATH="$HOME/.local/bin:$PATH"
Quick Start
Create a repo with guided prompts:
repo
Create a private Flask project without confirmation:
repo my-api --private --template flask --yes
Create a public React repo and open it in the browser after push:
repo my-ui --public --template react --open
How It Works
When you run repo, ghinit:
- Verifies
gitandghare installed and thatghis authenticated. - Creates the remote GitHub repository with
gh repo create. - Applies an optional bundled or custom template.
- Fetches a
.gitignoresuggestion from GitHub's gitignore templates API. - Initializes the local git repository, commits, adds the remote, and pushes.
Commands
repo
Create a repository in the current directory.
Options:
--publiccreate a public repository--privatecreate a private repository--template <name>choose a scaffold template-y, --yesskip the confirmation prompt--openopen the repository in the browser after a successful push--versionprint the installed version
repo config
View or update persistent defaults stored in ~/.ghinit.toml.
Examples:
repo config
repo config --show
repo config --reset
Config shape:
[defaults]
visibility = "private"
template = "none"
remote = "origin"
[templates]
custom_dir = "~/my-templates"
repo templates
List the available built-in templates plus any templates discovered in the configured custom template directory.
Built-In Templates
flask: Minimal Flask API with a health check routefastapi: Minimal FastAPI servicereact: React + Vite starterdjango: Minimal Django project scaffoldcli: Click-based Python CLI scaffoldml: Notebook-first machine learning project scaffold
Templates can declare metadata through template.toml and may use:
{{repo_name}}{{author}}
These variables are rendered into file contents and template paths during copy.
Custom Templates
Set a custom template directory:
repo config
Point custom_dir to a folder that contains one subdirectory per template. Each
template can include a template.toml file:
[meta]
name = "Internal API"
description = "Company starter service"
language = "Python"
post_install = "Run: uv sync"
Development
Run tests:
python -m unittest discover -s tests -v
Build a distribution locally:
python -m build
Release Process
The repository includes GitHub Actions workflows for:
- running tests on every push and pull request
- building and publishing to PyPI when a tag like
v1.0.0is pushed
To publish a release:
- Update code and docs.
- Push to
mainand confirm CI passes. - Create and push a version tag:
git tag v1.0.0
git push origin v1.0.0
- Ensure the repository has a
PYPI_API_TOKENsecret configured.
Demo
The README is prepared for a future GIF or terminal recording section. No demo asset is bundled in the repository yet.
Project details
Release history Release notifications | RSS feed
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 ghinit-1.0.1.tar.gz.
File metadata
- Download URL: ghinit-1.0.1.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fb83862b54eb81434ac9b5016260bd1eb81e76111e76c65daf10a8b42e12eb0
|
|
| MD5 |
8d815a63c97584c1ecd71cc015025137
|
|
| BLAKE2b-256 |
9be1db768fa4859d263acd3da04533ca90e9d64cabcaa35a3f335f3166df7611
|
File details
Details for the file ghinit-1.0.1-py3-none-any.whl.
File metadata
- Download URL: ghinit-1.0.1-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf30b33134d7118a437b75cbd04158203cb8ff67b0d85de1c66ba933f431e0cf
|
|
| MD5 |
3e96db13520251d01b76f2cb4093fe9a
|
|
| BLAKE2b-256 |
3bc8241e885eeec15fa1782dca5c949540c80936d762d9658b283f3d9e0b5d52
|