You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Github CLI执行gh auth refresh命令无法唤起浏览器,终端显示HTML内容

解决gh auth refresh无法唤起浏览器且输出HTML的问题

修复步骤

  • 验证系统浏览器关联
    终端唤起浏览器依赖系统默认浏览器配置,先执行对应命令测试:

    # Linux
    xdg-open https://github.com
    # macOS
    open https://github.com
    # Windows(PowerShell)
    Start-Process https://github.com
    

    如果命令无法打开浏览器,先修复系统默认浏览器的关联设置。

  • 手动提取授权URL完成认证
    重新执行gh auth refresh -h github.com -s codespace,在终端输出的HTML内容里,找到包含https://github.com/login/oauth/authorize的链接,复制到浏览器打开,完成登录授权后返回终端继续操作。

  • 重置GitHub CLI认证状态
    若上述方法无效,先注销现有认证再重新授权:

    gh auth logout -h github.com
    gh auth login -h github.com -s codespace
    

    执行gh auth login时选择浏览器登录选项,按提示完成流程。

  • 升级GitHub CLI版本
    旧版本可能存在兼容性问题,升级到最新版再尝试:

    gh upgrade
    

内容的提问来源于stack exchange,提问作者Justin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 20:45:41