A Claude Code slash command that pushes your current directory to a private GitHub repository with a smart, auto-generated commit message.
Type /push-to-github in Claude Code and it will:
- Analyze your changes and generate a descriptive commit message
- Create a
.gitignoreif one doesn't exist (auto-detects Node, Python, Go, Rust, Ruby, .NET, C/C++) - Initialize git and create a private GitHub repo if needed
- Commit and push
- GitHub CLI (
gh) — installed and authenticated (gh auth login) git
mkdir -p ~/.claude/commands ~/.claude/scripts && \
curl -fsSL https://raw.githubusercontent.com/stellarthemes/claude-push-to-github/main/push-to-github.md \
-o ~/.claude/commands/push-to-github.md && \
curl -fsSL https://raw.githubusercontent.com/stellarthemes/claude-push-to-github/main/push-to-github.sh \
-o ~/.claude/scripts/push-to-github.sh && \
chmod +x ~/.claude/scripts/push-to-github.shInside Claude Code:
/push-to-github # auto-generate commit message
/push-to-github my-repo # specify repo name
/push-to-github my-repo "Initial commit" # specify repo name and message
~/.claude/
commands/
push-to-github.md # slash command definition
scripts/
push-to-github.sh # deployment script
If no .gitignore exists, one is created automatically with patterns for:
- Always: secrets (
.env,*.pem,*.key,credentials.json), OS files, editor files - Node.js (detected via
package.json):node_modules/,dist/,.next/,coverage/ - Python (detected via
requirements.txt,pyproject.toml, etc.):__pycache__/,.venv/,*.pyc - Go (detected via
go.mod):vendor/,*.exe - Rust (detected via
Cargo.toml):target/ - Ruby (detected via
Gemfile):vendor/bundle/,.bundle/ - .NET (detected via
*.sln,*.csproj):bin/,obj/ - C/C++ (detected via
CMakeLists.txt,Makefile):build/,*.o,*.so
MIT