Open
[转交][user feedback][9964] grape git 在 GitHub 宿主仓库无法推送(凭据未注入且失败原因不可见),文档缺 GitHub 用法 #266
马岩松Add on 7 days ago
grape_bot
7 days ago Comments:
7 days ago Comments:
[VOD Agent] 本单需求四要素齐备(目标/现状/期望/验收),但与本仓既有待办重复,按去重结论回复:不重复建 Spec、不重复交办。
归仓判断:已执行,结论=本仓(grape-dev/grape-cli),依据=地图命中(grape-cli 为官方 CLI 客户端仓;grape git 远端凭据注入、失败文案与 CLI 文档均在 grape_cli/commands/git.py 与本仓 README/docs 内实现)。
main 实测核验(commit cae332e,2026-11-19)
- GitHub 宿主白名单已实现:
grape_cli/commands/git.py中_GITHUB_HOSTS = frozenset({github.com, www.github.com}),并入_SUPPORTED_HOSTS;_repo_from_url()覆盖https:///git@host:o/r/ssh://三种形态,.git后缀可缺省。 - 该实现已随 v0.3.4(2026-11-14) 发布:CHANGELOG
[0.3.4]明确「credential injection supports github.com hosted repos」,对应 PR !5(merged,2026-11-14)。 - 本机实装 CLI 0.3.4 代码含该白名单 ⇒ 「0.3.4 及以上」具备 GitHub 换券能力。
根因判定(按可能性排序)
- 复现环境 CLI 版本 < 0.3.4(最可能):
_repo_from_url()命中不了 github host →owner_repo为空 → 整个注入分支被跳过,stderr 无任何提示,直接走匿名 HTTPS 失败,现象正好是could not read Username(与「完全未注入凭据」一致)。取证方式:在复现 worker 打印grape --version。 - 换券失败被降级吞掉:现有
git.py仅输出warning: grape git credential injection failed (...); falling back to native git behavior,不含失败环节(URL 解析 / 换券 / 注入)、host、repo_key,也无兜底命令提示 → 即本单第 2 项「可诊断性」诉求,属真实缺口。 - remote 形态未命中:解析器已覆盖 https / scp / ssh 三种,但非默认端口、企业域名变体无单测覆盖。
去重映射(本仓既有单)
- #140(open,spec-ready / P1 / documentation):已覆盖「注入失败显式告警 + 标准兜底(
grape repos git credential+ GIT_ASKPASS/credential.helper)」与「README/runbook 标准凭据流程」,与本单期望 2、3 重叠,建议本单实测证据并入该单。 - #148(open):GitHub 宿主无注入;能力侧已由 PR !5 / v0.3.4 关闭实现,剩余为版本分发问题。
- #217(open):换券首次 403 需自动重试或 runbook 注明,与本单「换券失败不可见」互补。
- PR #38(open,
fix(git): scope credential header to repo host):当前 main 仍使用全局http.extraheader,与注入路径属同一凭据面。
文档现状澄清:README(README.md / README.zh.md)第 178-194、209-214 行已写明 gitcode.com / github.com 双宿主注入与失败降级,但缺三项:生效最低版本(0.3.4+)、支持的 remote 形态、失败时的 兜底样例;docs/ 下无独立 GitHub 用法文档。
建议去向(供维护者 / Issue Agent 决策)
- 本单并入 #140,并把「worker 侧
grape --version核对」列为第一条排查动作与验收前置。 - 文档补齐最低版本、remote 形态、兜底样例,落在 #140 的 documentation 范围。
- 换券瞬时失败重试按 #217 处理;凭据 header host 作用域按 PR #38 处理。
备注:本单正文提到的技能包
references/grape-cli-reference.md话术过期,属grape-dev/grape-skills资产,待 #140 确定权威用法段落后由技能侧另行同步,不在本仓改。


目标
grape git在 GitHub 托管仓库(https remote,如https://github.com/<org>/<repo>.git)执行 push 时凭据注入生效,push 不再因匿名访问失败;注入不可用时给出可操作的明确错误与兜底路径,并在 CLI 文档中补齐 GitHub 宿主用法。现状(用户实测,2026-11-19 11:11 CST)
grape git push origin feat/x(github.com 宿主仓)fatal: could not read Username for 'https://github.com'—— 表现为完全未注入凭据,git 回落到匿名 HTTPSgrape repos git credential取券 + credential.helper 转交可成功推送 ⇒ 换券能力本身可用,失效点在注入路径/版本references/grape-cli-reference.md中「仅 gitcode.com 宿主注入」一句判定 GitHub 场景无官方路径,文档与代码现状已不一致已核实的代码现状(供定位参考,非结论)
grape-climain 分支grape_cli/commands/git.py:_GITCODE_HOSTS与_GITHUB_HOSTS合并为_SUPPORTED_HOSTS(第 21-25 行),_repo_from_url()已识别 github 的 https/scp/ssh 形态;本地实测安装版本grape-cli 0.3.4已含该实现GET /api/repos/{owner}/{repo}/git-credential(src/api/routes/repos.py,operation_idrepos_git_credential)按 repo_key 前缀分流 provider,GitHub 走用户 github tokencommands/git.py约 120-122 行)→ 用户侧只能看到could not read Username,真实失败原因(换券 502 / owner-repo 解析为空 / 版本不含 github 白名单)不可见需要排查的成因(按可能性)
_SUPPORTED_HOSTS(需在复现环境打印grape --version与commands/git.py中白名单确认);_repo_from_url()对该仓库 remote 形态未命中(如无.git后缀、ssh 形态、含端口/企业域名变体),返回空串后整体跳过注入;期望行为
grape git push注入短期凭据并推送成功(与 gitcode 同等能力);grape repos git credential+ credential.helper/askpass 样例),退出码可辨识;验收标准
备注(跨仓同步项)
技能包内的
references/grape-cli-reference.md(coding/vod 技能引用)同段话术已过期,属grape-dev/grape-skills资产;本单确定权威用法段落后,技能侧文档同步另行处理,不在本仓改。来源:grape-dev/grape#3366(由 VOD Agent 归仓判断转交)
auto-submitted by VOD Agent