Title: 在Windows下安装了git.exe,仍然提示deepcode: Deep Code on Windows requires Git Bash. Install Git for Windows and ensure git.exe is available in PATH. · Issue #38 · lessweb/deepcode-cli · GitHub
Open Graph Title: 在Windows下安装了git.exe,仍然提示deepcode: Deep Code on Windows requires Git Bash. Install Git for Windows and ensure git.exe is available in PATH. · Issue #38 · lessweb/deepcode-cli
X Title: 在Windows下安装了git.exe,仍然提示deepcode: Deep Code on Windows requires Git Bash. Install Git for Windows and ensure git.exe is available in PATH. · Issue #38 · lessweb/deepcode-cli
Description: PS C:\Users\abc> deepcode deepcode: Deep Code on Windows requires Git Bash. Install Git for Windows and ensure git.exe is available in PATH. PS C:\Users\abc> git.exe usage: git [-v | --version] [-h | --help] [-C ] [-c =] [--exec-path[=]]...
Open Graph Description: PS C:\Users\abc> deepcode deepcode: Deep Code on Windows requires Git Bash. Install Git for Windows and ensure git.exe is available in PATH. PS C:\Users\abc> git.exe usage: git [-v | --version] [-h...
X Description: PS C:\Users\abc> deepcode deepcode: Deep Code on Windows requires Git Bash. Install Git for Windows and ensure git.exe is available in PATH. PS C:\Users\abc> git.exe usage: git [-v | --versio...
Opengraph URL: https://github.com/lessweb/deepcode-cli/issues/38
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"在Windows下安装了git.exe,仍然提示deepcode: Deep Code on Windows requires Git Bash. Install Git for Windows and ensure git.exe is available in PATH.","articleBody":"PS C:\\Users\\abc\u003e deepcode\ndeepcode: Deep Code on Windows requires Git Bash. Install Git for Windows and ensure git.exe is available in PATH.\nPS C:\\Users\\abc\u003e git.exe\nusage: git [-v | --version] [-h | --help] [-C \u003cpath\u003e] [-c \u003cname\u003e=\u003cvalue\u003e]\n [--exec-path[=\u003cpath\u003e]] [--html-path] [--man-path] [--info-path]\n [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch]\n [--no-optional-locks] [--no-advice] [--bare] [--git-dir=\u003cpath\u003e]\n [--work-tree=\u003cpath\u003e] [--namespace=\u003cname\u003e] [--config-env=\u003cname\u003e=\u003cenvvar\u003e]\n \u003ccommand\u003e [\u003cargs\u003e]\n\nThese are common Git commands used in various situations:\n\nstart a working area (see also: git help tutorial)\n clone Clone a repository into a new directory\n init Create an empty Git repository or reinitialize an existing one\n\nwork on the current change (see also: git help everyday)\n add Add file contents to the index\n mv Move or rename a file, a directory, or a symlink\n restore Restore working tree files\n rm Remove files from the working tree and from the index\n\nexamine the history and state (see also: git help revisions)\n bisect Use binary search to find the commit that introduced a bug\n diff Show changes between commits, commit and working tree, etc\n grep Print lines matching a pattern\n log Show commit logs\n show Show various types of objects\n status Show the working tree status\n\ngrow, mark and tweak your common history\n backfill Download missing objects in a partial clone\n branch List, create, or delete branches\n commit Record changes to the repository\n merge Join two or more development histories together\n rebase Reapply commits on top of another base tip\n reset Reset current HEAD to the specified state\n switch Switch branches\n tag Create, list, delete or verify tags\n\ncollaborate (see also: git help workflows)\n fetch Download objects and refs from another repository\n pull Fetch from and integrate with another repository or a local branch\n push Update remote refs along with associated objects\n\n'git help -a' and 'git help -g' list available subcommands and some\nconcept guides. See 'git help \u003ccommand\u003e' or 'git help \u003cconcept\u003e'\nto read about a specific subcommand or concept.\nSee 'git help git' for an overview of the system.\n===============================================\n使用的是windows 11系统,deepcode -v 是0.1.18。git-bash也是有的。\n===============================================\n以下是deepseek,供参考。\n● 已经完成了完整的代码分析。以下是结论:\n \n ────────────────────────────────────────────────────────────\n \n `findGitBashPath()` 完整调用路径\n \n cli.tsx L102 configureWindowsShell()\n → setShellIfWindows() [shell-utils.ts L17]\n → findGitBashPath() [shell-utils.ts L23]\n → findAllWindowsExecutableCandidates(\"git\") [L158]\n → execFileSync(\"where.exe\", [\"git\"]) [L160] ← 查找 PATH\n + WINDOWS_GIT_LOCATIONS (2个硬编码路径) [L6-9]\n → filterWindowsExecutableCandidates() [L170] ← 检查文件存在性\n → 对每个候选git路径,拼合 ../../bin/bash.exe 并检查是否存在\n → 全部不存在则抛出错误\n \n 你的系统上发生了什么\n \n 从我刚才执行的诊断命令可以看到,你的环境中 `where.exe` 不可用。这意味着 `findAllWindowsExecutableCandidates` 的第一步就抛异常了,代码捕获后只回退到\n 2 个硬编码路径:\n \n C:\\Program Files\\Git\\cmd\\git.exe\n C:\\Program Files (x86)\\Git\\cmd\\git.exe\n \n 如果你的 Git 安装在这两个路径之外(例如装了新版 Git 但选了自定义目录、或者通过 Scoop/Chocolatey/Portable\n 安装),那么这两个路径都不存在,`filterWindowsExecutableCandidates` 返回空数组,`for` 循环零次执行,直接命中 `throw new Error(...)`。\n \n 根本原因总结\n \n │ 环节 │ 具体问题 │\n │ 查找手段单一 │ 只用 `where.exe` 查 PATH,没有用 `reg query` 查注册表,也没有检查 `Gi… │\n │ 硬编码路径有限 │ 只写了两个标准安装路径,无法覆盖自定义安装、Scoop、Chocolatey、Portab… │\n │ 路径推算脆弱 │ `git.exe → ../../bin/bash.exe` 硬编码了 Git for Windows 的标准目录布… │\n │ 错误信息不准确 │ 说\"确保 git.exe 在 PATH 中\",但实际上即使 git.exe 在 PATH 里,只要 `.… │\n \n 修复方向(如果你要改源码)\n \n 有几种改法:\n 1. 增加更多 Fallback 路径 — 在 `WINDOWSGITLOCATIONS` 之外,扫描 `%USERPROFILE%\\scoop\\apps\\git\\current`、注册表中的 Git 安装路径\n 2. 直接从 `reg query` 读取 Git 安装位置 — `HKLM\\SOFTWARE\\GitForWindows` 或 `HKCU\\Software\\GitForWindows`\n 3. 不推算路径,直接找 `bash.exe` 本身 — 用 `where.exe bash` 或扫描常见位置(`Program Files\\Git\\bin\\bash.exe`、`Program Files\\Git\\usr\\bin\\bash.exe`)\n 4. 改进错误信息 — 区分\"没找到 git.exe\"和\"找到了 git.exe 但没找到配套的 bash.exe\"","author":{"url":"https://github.com/facat","@type":"Person","name":"facat"},"datePublished":"2026-05-11T02:37:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/38/deepcode-cli/issues/38"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e852b0b0-a4e8-27a0-19c2-d166b85e2b3f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E324:19E229:36F0B0:4AF35E:6A4D9EE4 |
| html-safe-nonce | 7d34bc834fa75fcc4030c00b4aa47a6b779ae5c5b6382b9f739e8675635ad658 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzI0OjE5RTIyOTozNkYwQjA6NEFGMzVFOjZBNEQ5RUU0IiwidmlzaXRvcl9pZCI6IjYwNDk3Nzk0MTA2Nzk2NDEzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 56cbe163b03bc49d9e11863ee3e5008ea6a57616ae98ec549742a428c1d0eb9a |
| hovercard-subject-tag | issue:4417684655 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/lessweb/deepcode-cli/38/issue_layout |
| twitter:image | https://opengraph.githubassets.com/10f74f90a8f749e5f1f96b09c9c2ce88c7dda2a92f5989330a495c425bc9d076/lessweb/deepcode-cli/issues/38 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/10f74f90a8f749e5f1f96b09c9c2ce88c7dda2a92f5989330a495c425bc9d076/lessweb/deepcode-cli/issues/38 |
| og:image:alt | PS C:\Users\abc> deepcode deepcode: Deep Code on Windows requires Git Bash. Install Git for Windows and ensure git.exe is available in PATH. PS C:\Users\abc> git.exe usage: git [-v | --version] [-h... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | facat |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/lessweb/deepcode-cli git https://github.com/lessweb/deepcode-cli.git |
| octolytics-dimension-user_id | 118287711 |
| octolytics-dimension-user_login | lessweb |
| octolytics-dimension-repository_id | 1223512305 |
| octolytics-dimension-repository_nwo | lessweb/deepcode-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1223512305 |
| octolytics-dimension-repository_network_root_nwo | lessweb/deepcode-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7f13faa65cccc9b729d674da83335d5dcfdfd193 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width