Skip to main content

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.toml so repeated setup takes less time.

Requirements

  • Python 3.8+
  • git
  • gh authenticated with gh 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:

  1. Verifies git and gh are installed and that gh is authenticated.
  2. Creates the remote GitHub repository with gh repo create.
  3. Applies an optional bundled or custom template.
  4. Fetches a .gitignore suggestion from GitHub's gitignore templates API.
  5. Initializes the local git repository, commits, adds the remote, and pushes.

Commands

repo

Create a repository in the current directory.

Options:

  • --public create a public repository
  • --private create a private repository
  • --template <name> choose a scaffold template
  • -y, --yes skip the confirmation prompt
  • --open open the repository in the browser after a successful push
  • --version print 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 route
  • fastapi: Minimal FastAPI service
  • react: React + Vite starter
  • django: Minimal Django project scaffold
  • cli: Click-based Python CLI scaffold
  • ml: 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.0 is pushed

To publish a release:

  1. Update code and docs.
  2. Push to main and confirm CI passes.
  3. Create and push a version tag:
git tag v1.0.0
git push origin v1.0.0
  1. Ensure the repository has a PYPI_API_TOKEN secret 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghinit-1.0.1.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ghinit-1.0.1-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

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

Hashes for ghinit-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5fb83862b54eb81434ac9b5016260bd1eb81e76111e76c65daf10a8b42e12eb0
MD5 8d815a63c97584c1ecd71cc015025137
BLAKE2b-256 9be1db768fa4859d263acd3da04533ca90e9d64cabcaa35a3f335f3166df7611

See more details on using hashes here.

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

Hashes for ghinit-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf30b33134d7118a437b75cbd04158203cb8ff67b0d85de1c66ba933f431e0cf
MD5 3e96db13520251d01b76f2cb4093fe9a
BLAKE2b-256 3bc8241e885eeec15fa1782dca5c949540c80936d762d9658b283f3d9e0b5d52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page