
whygit
io.github.Srikarmk由 GitHub 帳號 Srikarmk 發布v0.1.2更新於 Oct 26, 2026
Read-only Git explainer: what state a repo is in, what an error means, and the exact fix.
概覽
唯讀的 Git 解說器 MCP 伺服器,讓助理了解儲存庫目前狀態、Git 錯誤訊息的意思,以及確切的修正方式。
- 可以做什麼
- 診斷儲存庫:依急迫程度列出找到的所有問題,並附上白話說明與建議的修正指令
- 解釋 Git 錯誤訊息,可選擇搭配儲存庫狀態提供背景資訊
- 彙整儲存庫狀態:分支、上游、領先/落後、遠端、已暫存與已修改檔案、進行中的操作
- 可辨識合併衝突、中斷的 rebase、分離的 HEAD、被拒絕的推送、大型檔案、疑似金鑰檔案及多種常見錯誤
- 適用情境
- 適合助理在 Git 儲存庫中工作、需要給出可靠診斷而非憑 git status 猜測的情況,尤其適合初學者卡在合併衝突、中斷的 rebase、分離的 HEAD 或被拒絕的推送時。
- 執行需求
- 透過 uvx(PyPI 套件 whygit)以 stdio 在本機執行。需要 Python 3.10 或更新版本以及 Git。未宣告需要帳號、API 金鑰或環境變數。建議傳入絕對路徑,因為相對路徑會相對於伺服器的工作目錄解析。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 whygit,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
whygit
[CI] [PyPI] [Python] [MCP registry] [License] [Case study]
What just happened to my Git repository, and how do I fix it?
whygit looks at a Git repository and tells you, in plain English, what state it is in and which commands will get you out of it: a merge conflict, a rebase stopped halfway, a detached HEAD, a rejected push, a login GitHub won't accept, a 120 MB CSV that GitHub will refuse. Paste it an error message and it explains that too.
It is written for people meeting Git for the first time. Git's own messages are accurate but hard to read; whygit turns them into a short explanation and the exact fix.
It only ever reads your repository. It never runs the fixes it suggests, so you stay in control and learn the commands as you go.
There are two ways to use it, built on the same engine:
- On the command line, with no AI tools involved:
whygit. - As an MCP server, so an assistant such as Claude Code, Claude Desktop or Cursor gets a
reliable diagnosis instead of guessing from
git status.
Install
whygit needs Python 3.10 or newer and Git. Pick one:
This works the same on macOS, Windows and Linux.
Use it from the terminal
Run it inside your project folder:
Options: --path <folder> (or -C) to look at another folder, --json for machine-readable
output, --no-color to turn off colour. Colour is only used in a real terminal and never
when NO_COLOR is set.
Exit codes: 0 nothing blocking, 1 something blocking was found, 2 bad usage (for example
the folder does not exist), 3 explain did not recognise the message.
Example
Commands that can lose work (git restore, git rebase --skip, git push --force-with-lease
and so on) are always marked with a warning, and a safer option is listed first when one
exists.
Use it with an AI assistant (MCP)
whygit mcp runs a Model Context Protocol server over stdio with three read-only tools:
Results are small JSON objects. Pass an absolute path: relative paths resolve against the
server's working directory, which for desktop apps is usually not your project. ~ works.
Claude Code
--scope user makes it available in every project; leave it out to add it to the current
project only. Check it with claude mcp list.
Claude Desktop
Open Settings > Developer > Edit Config, and add whygit to
claude_desktop_config.json (on macOS ~/Library/Application Support/Claude/, on Windows
%APPDATA%\Claude\):
Restart Claude Desktop. If it can't find uvx, use the full path that which uvx (macOS)
or where uvx (Windows) prints as the command.
Cursor
Add the same block to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json in a project:
If you installed whygit with uv tool install or pipx, you can use "command": "whygit"
with "args": ["mcp"] instead.
What it recognises
Repository states: merge conflicts (and a merge that is resolved but not committed, including
leftover <<<<<<< markers), a rebase stopped on a conflict or an edit, cherry-pick, revert,
git am and bisect in progress, detached HEAD (and commits that no branch points to),
diverged / behind / ahead of the upstream, no upstream yet (the first git push -u), no
remote, upstream branch deleted, no commits yet, not a repository (including being one folder
too high, and your home folder), a home folder that was accidentally turned into a
repository, nested repositories (common with downloaded starter code), files over GitHub's
100 MB limit (and over 50 MB) staged or in unpushed commits, files that usually hold secrets
(.env, id_rsa, *.pem, kaggle.json, credentials JSON), notebooks with large saved
outputs, Jupyter notebook conflicts, missing user.name / user.email, a leftover
index.lock, and folders Git refuses because of "dubious ownership".
Error messages: rejected pushes, "You have divergent branches", "refusing to merge unrelated
histories", GitHub login failures (passwords no longer work; it explains tokens, SSH and
gh auth login, and never asks for your token), Permission denied (publickey), repository
not found, 403, "Your local changes would be overwritten", untracked files in the way,
"not a git repository", "src refspec main does not match any", "pathspec did not match",
"remote origin already exists", missing upstream, "couldn't find remote ref", GitHub's
large-file rejection (GH001), "detected dubious ownership", "Please tell me who you are",
index.lock exists, line-ending warnings, network errors, and more. If it doesn't recognise
a message, it says so and shows what it can see in the repository instead.
The read-only promise
whygit never changes your repository, and this is enforced in code rather than left to good intentions:
- Every Git command goes through a single function that only accepts read-only subcommands
(
status,rev-parse,for-each-ref,rev-list,diff,log,ls-files,cat-file,config --get,remote -v, ...) and refuses anything else, including the writing forms ofconfig,remoteandsymbolic-ref. - It sets
GIT_OPTIONAL_LOCKS=0, so evengit statusdoesn't refresh the index, and turns off external diff programs and the fsmonitor hook. - It never runs
git fetch. Ahead/behind counts are "as of your last fetch", and whygit tells you to rungit fetchyourself when that matters. - The test suite builds each state in a real repository, snapshots every file under
.git(names, timestamps and contents) before and after diagnosing, and checks nothing changed. It also checks that no other module in the package can start a process or write a file.
Credentials are never printed: a remote address like https://name:[email protected]/...
is shown as https://***@github.com/..., in every output.
Privacy
whygit collects nothing and makes no network calls. It reads your repository on your own computer and prints the result. That's all.
Licence
MIT. Copyright (c) 2026 Kameswara Sai Srikar Manda.
來源:README.md,提交 9a49c10
工具
0版本歷史
1- v0.1.2最新Oct 20, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分