No description
  • Python 54.2%
  • Shell 45.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-12-04 01:49:47 -05:00
config.jsonc Make config path and pull from git repo if doesn't exist 2026-11-01 15:59:32 -05:00
git-init added binary and installer files 2026-12-04 01:34:24 -05:00
git_init.py Make config path and pull from git repo if doesn't exist 2026-11-01 15:59:32 -05:00
install.sh Update install.sh 2026-12-04 01:49:47 -05:00
README.md Update README.md 2026-12-04 01:48:18 -05:00

git-init

A small Python utility that automates the initial setup of a Git repository.

git-init initializes a repository in the current directory, configures its origin remote, and optionally creates an initial commit and pushes it to the remote.

Features

  • Choose between SSH and HTTP remote URLs.
  • Configure the initial branch name.
  • Optionally create an initial commit.
  • Optionally push the initial commit to origin.
  • Customize behavior through config.jsonc.

Installation

Requirements:

  • Git
  • Python 3.9 or newer
  • Access to the Forgejo server through Tailscale
  • SSH access to Forgejo configured if using SSH remotes

Run the installer:

curl -fsSL http://forgejo.sage-root.space/sage-root/git-init/raw/branch/main/install.sh | bash

The installer clones the project, creates a Python virtual environment, installs dependencies, and adds the git-init command to ~/.local/bin.

If ~/.local/bin is not in your PATH, add it:

export PATH="$HOME/.local/bin:$PATH"

Usage

Navigate to the directory where you want to initialize a repository and run:

git-init

Follow the prompts to configure the remote URL, branch, initial commit, and push behavior.

Configuration

Your configuration is stored at:

~/.config/git-init/config.jsonc

Edit this file to customize remote URL rules, branch defaults, and commit behavior.

Updating

To update git-init, run the installer again:

curl -fsSL http://100.86.72.11:3000/sage-root/git-init/raw/branch/main/install.sh | bash

The installer pulls the latest changes from Forgejo and updates the dependencies. Your existing configuration is preserved.

Uninstalling

Remove the installed program and launcher:

rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/git-init"
rm -f "$HOME/.local/bin/git-init"

To also remove your configuration:

rm -rf "${XDG_CONFIG_HOME:-$HOME/.config}/git-init"

The configuration removal is optional. Keeping it allows you to preserve your settings if you reinstall later.