一个使用 Go 语言编写的 CLI,它可以使用 ChatGPT AI(GPT-4.1、GPT-4o 模型)编写 git 提交消息或为您进行代码审查,并自动安装
一个使用 Go 语言编写的 CLI,它可以使用 ChatGPT AI(GPT-4.1、GPT-4o 模型)编写 git 提交消息或为您进行代码审查,并自动安装
A CLI tool written in Go that generates git commit messages or provides code review summaries using ChatGPT AI (gpt-5, gpt-4o, gpt-4 model). It also automatically installs a git prepare-commit-msg hook.
en, zh-tw, or zh-cn).Install via Homebrew:
brew tap appleboy/tap
brew install codegptInstall via Chocolatey:
choco install codegptFor most systems, you can use an install script or manually download a pre-compiled binary.
Run the install script to automatically download and set up the latest release:
bash < <(curl -sSL https://raw.githubusercontent.com/appleboy/CodeGPT/main/install.sh)Or download and run manually:
curl -LO https://raw.githubusercontent.com/appleboy/CodeGPT/main/install.sh
chmod +x install.sh
./install.shDownload the latest pre-compiled binary from the release page.
Change permissions:
chmod 755 codegptMove the binary to your system bin directory:
mv codegpt /usr/local/bin/Confirm installation:
codegpt version| Variable Name | Default Value | Description |
|---|---|---|
| VERSION | latest | The CodeGPT version to install (defaults to latest release) |
| INSTALL_DIR | $HOME/.codegpt/bin | Installation directory |
| INSECURE | unset (disabled) | If set to any value, skips SSL verification. Enabled when variable is present |
Example usage:
# Install with insecure mode enabled (ignoring curl SSL verification):
INSECURE=1 ./install.sh
# Install a specific version to a custom directory:
VERSION=1.1.0 INSTALL_DIR=/opt/codegpt ./install.shThe script will:
Install from source code:
go install github.com/appleboy/CodeGPT/cmd/codegpt@latestAdd the feature to your devcontainer.json:
"features": {
"ghcr.io/kvokka/features/codegpt:1": {}
}First, create your OpenAI API Key. The OpenAI Platform allows you to generate a new API Key.
Set the environment variable OPENAI_API_KEY:
export OPENAI_API_KEY=sk-xxxxxxxAlternatively, store your API key in a custom config file:
codegpt config set openai.api_key sk-xxxxxxxThis will create a .codegpt.yaml file in your home directory ($HOME/.config/codegpt/.codegpt.yaml). The following options are available:
| Option | Description |
|---|---|
| openai.base_url | Replace the default base URL (https://api.openai.com/v1). |
| openai.api_key | Generate API key from openai platform page. |
| openai.api_key_helper | Shell command to dynamically generate API key (e.g., from password manager or secret service). |
| openai.api_key_helper_refresh_interval | Interval in seconds to refresh credentials from api_key_helper (default: 900 seconds / 15 minutes). Set to 0 to disable caching. |
| openai.org_id | Identifier for this organization sometimes used in API requests. See organization settings. Only for openai service. |
| openai.model | Default model is gpt-4o, you can change to other custom model (Groq or OpenRouter provider). |
| openai.proxy | HTTP/HTTPS client proxy. |
| openai.socks | SOCKS client proxy. |
| openai.timeout | Default HTTP timeout is 10s (ten seconds). |
| openai.skip_verify | Default skip_verify is false, You can change it to true to ignore SSL verification. |
| openai.max_tokens | Default max tokens is 300. See reference max_tokens. |
| openai.temperature | Default temperature is 1. See reference temperature. |
| git.diff_unified | Generate diffs with <n> lines of context, default is 3. |
| git.exclude_list | Exclude file from git diff command. |
| openai.provider | Default service provider is openai, you can change to azure. |
| output.lang | Default language is en and available languages zh-tw, zh-cn, ja. |
| openai.top_p | Default top_p is 1.0. See reference top_p. |
| openai.frequency_penalty | Default frequency_penalty is 0.0. See reference frequency_penalty. |
| openai.presence_penalty | Default presence_penalty is 0.0. See reference presence_penalty. |
| openai.stream | Enable streaming output for real-time token display, default is false. |
| prompt.folder | Default prompt folder is $HOME/.config/codegpt/prompt. |
Instead of storing your API key directly in the config file, you can use a shell command to dynamically retrieve it from a password manager or secret service. This is especially useful for:
暂无开放 Issues,或尚未同步最近议题。