Automate git commits with AI-generated messages in Conventional Commits format.
- Python 3.7+
- Git
- Bash (Git Bash on Windows)
- API token: AITUNNEL (default), OpenAI, or Hugging Face
git clone https://github.com/Father1993/CommitPilot.git
cd CommitPilot
bash install.sh
source ~/.bashrc # Git Bash on Windows; use ~/.bash_profile if neededThe installer:
- installs Python dependencies (
requests,python-dotenv,openai) - creates
config.iniif missing - adds shell aliases
- installs the git hook in the current repo (if
.gitexists)
All settings live in the CommitPilot directory (same folder as auto_commit.py).
Copy .env.example to .env and set your token:
AI_TUNNEL=sk-aitunnel-your-token-hereOptional overrides:
AITUNNEL_BASE_URL=https://api.aitunnel.ru/v1/
AITUNNEL_MODEL=gpt-4.1Edit config.ini (see config.ini.example):
[DEFAULT]
api_provider = aitunnel
branch = master
max_diff_size = 7000Tokens can also be set in config.ini, but .env takes priority for AI_TUNNEL.
Run from any git repository:
cd /path/to/your/project
acommit # git add, AI commit, push to default branch
acommit-here # git add, AI commit, no push
acommit-dev # commit and push to dev
acommit-main # commit and push to main
acommit-master # commit and push to masterShort aliases (same commands):
acum # same as acommit
acm # same as acommit-here
acmd # push to dev
acmm # push to main
acmmm # push to masterpython /path/to/CommitPilot/auto_commit.py [options]
-c, --commit-only Commit without push
-b, --branch NAME Push to branch (default from config.ini)
-m, --message TEXT Use custom message (skip AI)
-p, --provider NAME aitunnel | openai | huggingface
--test Check token and generate a test message
--get-message Print generated message only
--setup Interactive setup
--setup-hooks Install prepare-commit-msg hook in current repo
-v, --version Show versionAuto-generate a message when you run git commit with an empty message:
python /path/to/CommitPilot/auto_commit.py --setup-hooksOr copy manually:
cp /path/to/CommitPilot/prepare-commit-msg /path/to/project/.git/hooks/
chmod +x /path/to/project/.git/hooks/prepare-commit-msg- Read
git statusandgit diff - Send changes to the configured AI provider
- Run
git add .andgit commit -m "..." - Optionally
git push origin <branch>
Default provider: AITUNNEL (OpenAI-compatible API).
acommit --test| Problem | Fix |
|---|---|
| Token not configured | Add AI_TUNNEL=... to CommitPilot/.env |
| Aliases not found | Run source ~/.bashrc or open a new terminal |
| No changes to commit | Make sure you are in a repo with uncommitted changes |
| Hook not working | Set COMMITPILOT_PATH to the CommitPilot directory |
- Install Git for Windows (includes Git Bash).
- Install Python 3 and enable Add to PATH.
- Clone CommitPilot and run
bash install.shfrom Git Bash. - Reload shell:
source ~/.bashrc.
Aliases use absolute paths, so they work from any drive or directory.
python -m pip install pytest
python -m pytest tests/ -qCommitPilot/
├── auto_commit.py # CLI entry point
├── ai_common.py # AI providers and shared helpers
├── prepare-commit-msg # Git hook script
├── install.sh # Installer
├── config.ini.example
└── .env.example
MIT