Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Gitstart automates creating a GitHub repo. The script will create .gitignore, a license.txt, a README.md file and commit with a message. It will create a remote repo and push all the files.

License

Notifications You must be signed in to change notification settings

shinokada/gitstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

97 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gitstart

Automate GitHub repository creation with one command

License: MIT Version Tests ShellCheck

What is Gitstart?

Gitstart is a powerful Bash script that automates the entire process of creating a new Git repository and pushing it to GitHub. Instead of running multiple commands, you can initialize a complete project with proper structure in one line.

Before Gitstart:

mkdir my-project
cd my-project
git init
touch README.md LICENSE .gitignore
# ... manually create files ...
git add .
git commit -m "Initial commit"
gh repo create my-project --public
git remote add origin [email protected]:username/my-project.git
git push -u origin main

With Gitstart:

gitstart -d my-project -l python

Features

✨ Complete Automation

  • Creates directory structure
  • Initializes Git repository
  • Creates GitHub repository
  • Generates LICENSE, README.md, .gitignore
  • Commits and pushes to GitHub

🎯 Smart File Generation

  • Language-specific .gitignore files (Python, JavaScript, Go, Rust, etc.)
  • Multiple license options (MIT, Apache 2.0, GNU GPLv3)
  • Professional README.md template

πŸ”§ Flexible Configuration

  • Public or private repositories
  • Custom branch names
  • Custom commit messages
  • Repository descriptions
  • Dry-run mode to preview changes

πŸ›‘οΈ Safe and Reliable

  • Detects existing files and prompts before overwriting
  • Works with existing Git repositories
  • Automatic cleanup on errors
  • Comprehensive error handling

πŸ§ͺ Well Tested

  • Automated test suite with shellcheck and bats
  • CI/CD pipeline with GitHub Actions
  • Unit and integration tests
  • Cross-platform compatibility (Linux, macOS)

🌍 Cross-Platform

  • Works on macOS, Linux (Ubuntu, Debian, Fedora, Arch)
  • WSL2 support for Windows users
  • Tested on both platforms via CI/CD
  • OS-aware .gitignore generation

Quick Start

# Install (macOS)
brew tap shinokada/gitstart && brew install gitstart

# Login to GitHub
gh auth login

# Create your first repository
gitstart -d my-awesome-project

# That's it! Your project is now on GitHub

Installation

macOS (Homebrew)

brew tap shinokada/gitstart && brew install gitstart

Linux (Awesome Package Manager)

awesome install shinokada/gitstart

Debian/Ubuntu

# Download from releases page
wget https://github.com/shinokada/gitstart/releases/download/v0.4.1/gitstart_0.4.1_all.deb
sudo apt install ./gitstart_0.4.1_all.deb

Fedora/RHEL/CentOS

# Manual installation (no rpm package yet)
curl -o gitstart https://raw.githubusercontent.com/shinokada/gitstart/main/gitstart
chmod +x gitstart
sudo mv gitstart /usr/local/bin/

Arch Linux

# Manual installation (AUR package coming soon)
curl -o gitstart https://raw.githubusercontent.com/shinokada/gitstart/main/gitstart
chmod +x gitstart
sudo mv gitstart /usr/local/bin/

WSL2 (Windows)

# Use Ubuntu/Debian instructions
wget https://github.com/shinokada/gitstart/releases/download/v0.4.1/gitstart_0.4.1_all.deb
sudo apt install ./gitstart_0.4.1_all.deb

Manual Installation (All Platforms)

curl -o gitstart https://raw.githubusercontent.com/shinokada/gitstart/main/gitstart
chmod +x gitstart
sudo mv gitstart /usr/local/bin/

# Or install to user directory (no sudo needed)
mkdir -p ~/.local/bin
mv gitstart ~/.local/bin/
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Requirements

  • GitHub CLI (gh) - Installation guide
  • jq - JSON processor
  • Git - Version control
  • Bash - Shell (pre-installed on macOS/Linux)
# macOS
brew install gh jq

# Ubuntu/Debian
sudo apt install gh jq

# Fedora
sudo dnf install gh jq

# Arch Linux
sudo pacman -S github-cli jq

# Verify installation
gh --version
jq --version

Usage

Basic Usage

# Create a new repository
gitstart -d project-name

# With programming language
gitstart -d my-app -l python

# Private repository
gitstart -d secret-project -p

# In current directory
cd existing-project
gitstart -d .

All Options

gitstart [OPTIONS]

Options:
  -d, --dir DIR              Directory name or path (required)
  -l, --lang LANGUAGE        Programming language for .gitignore
  -p, --private              Create private repository (default: public)
  -b, --branch NAME          Branch name (default: main)
  -m, --message MESSAGE      Initial commit message (default: "Initial commit")
  -desc, --description TEXT  Repository description
  --dry-run                  Preview without executing
  -q, --quiet                Minimal output
  -h, --help                 Show help
  -v, --version              Show version

Examples

Python Project

gitstart -d my-python-app -l python

Private React App

gitstart -d react-app -l javascript -p -desc "My React application"

Custom Everything

gitstart -d full-config \
  -l go \
  -p \
  -b develop \
  -m "Project initialization v1.0" \
  -desc "A fully configured Go project"

Preview Before Creating

gitstart -d test-project --dry-run

Supported Languages

Python β€’ JavaScript β€’ Node β€’ TypeScript β€’ Go β€’ Rust β€’ Java β€’ C β€’ C++ β€’ C# β€’ Ruby β€’ PHP β€’ Swift β€’ Kotlin β€’ Scala β€’ Dart β€’ Elixir β€’ Haskell β€’ Perl β€’ R β€’ Lua β€’ and more!

Full list: https://github.com/github/gitignore

Documentation

πŸ“– Comprehensive Guides:

What's New in v0.4.0

πŸŽ‰ Major Update!

  • βœ… Private repository support
  • βœ… Custom commit messages
  • βœ… Custom branch names
  • βœ… Repository descriptions
  • βœ… Dry-run mode
  • βœ… Quiet mode for automation
  • βœ… Full support for existing directories
  • βœ… Automatic error cleanup
  • βœ… Better file conflict handling
  • βœ… XDG-compliant config location

See CHANGELOG.md for complete details.

Common Use Cases

1. Quick Project Setup

gitstart -d new-idea -l python
cd new-idea
# Start coding immediately!

2. Team Project

gitstart -d team-project \
  -l javascript \
  -b develop \
  -desc "Team collaboration project"

3. Initialize Existing Project

cd ~/Downloads/client-project
gitstart -d . -l go

4. Microservices

for service in user-svc payment-svc notification-svc; do
  gitstart -d "$service" -l go -p -q
done

5. Automated Scripts

#!/bin/bash
create_repo() {
  gitstart -d "$1" -l "${2:-python}" -q
}

create_repo "api-service" "go"
create_repo "web-frontend" "javascript"

How It Works

  1. Validates - Checks GitHub authentication and dependencies
  2. Creates - Makes directory (if needed) and GitHub repository
  3. Initializes - Sets up Git with proper configuration
  4. Generates - Creates LICENSE, README.md, and .gitignore
  5. Commits - Stages and commits all files
  6. Pushes - Uploads to GitHub with proper remote setup

Configuration

Gitstart stores your GitHub username in:

~/.config/gitstart/config

On first run, you'll be prompted to enter it. This follows XDG Base Directory standards.

Troubleshooting

"Not logged in to GitHub"

gh auth login

"jq not found"

# macOS
brew install jq

# Ubuntu/Debian
sudo apt install jq

"Repository already exists"

# Delete existing repo
gh repo delete username/repo-name --yes

# Or use different name
gitstart -d repo-name-v2

Config not found

  • Will prompt for username on first run
  • Manually set: echo "your-username" > ~/.config/gitstart/config

Uninstall

curl -s https://raw.githubusercontent.com/shinokada/gitstart/main/uninstall.sh | bash

Or manually:

# Remove script
sudo rm /usr/local/bin/gitstart  # or your installation path

# Remove config
rm -rf ~/.config/gitstart

Testing

Gitstart has a comprehensive test suite using shellcheck (static analysis) and bats (functional testing).

Quick Testing

# Run all tests
make test

# Or use the test runner directly
./tests/run-tests.sh

# Run specific tests
make test-shellcheck    # Static analysis only
make test-unit          # Unit tests only

Test Dependencies

# Install test dependencies
make install-deps

# Or manually:
brew install shellcheck bats-core  # macOS
sudo apt install shellcheck bats   # Ubuntu/Debian

Running Tests

All tests:

./tests/run-tests.sh

Shellcheck only:

./tests/shellcheck.sh

BATS unit tests:

bats tests/gitstart.bats

Specific test:

bats tests/gitstart.bats --filter "version"

CI/CD

Tests automatically run on push/PR via GitHub Actions:

  • βœ… ShellCheck static analysis
  • βœ… Unit tests on Ubuntu and macOS
  • βœ… Bash compatibility checks
  • βœ… Security scanning

See tests/README.md for detailed testing documentation.

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: make test or ./tests/run-tests.sh
  5. Ensure all tests pass
  6. Submit a pull request

For detailed testing guidelines, see tests/README.md.

Support

License

MIT License - see LICENSE file for details.

Copyright (c) 2021-2026 Shinichi Okada

Author

Shinichi Okada (@shinokada)

Acknowledgments

Thanks to all users who have provided feedback and contributed to making Gitstart better!


Star ⭐ the repo if you find it useful!

Buy Me a Coffee

About

Gitstart automates creating a GitHub repo. The script will create .gitignore, a license.txt, a README.md file and commit with a message. It will create a remote repo and push all the files.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors 3

  •  
  •  
  •