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

为何单个GitHub项目需密码验证且失败,其余项目可正常使用SSH认证?

解决GitHub推送要求密码认证失败的问题

问题根源

你重新拉取项目时使用了HTTPS协议的仓库地址,而本地环境配置的是SSH密钥认证,导致推送时触发了GitHub已废弃的密码认证流程,最终认证失败。

修复步骤

  • 查看当前项目的远程仓库地址,确认是HTTPS格式:

    git remote -v
    

    输出会显示类似:

    origin  https://github.com/entenschule/discrete_research.git (fetch)
    origin  https://github.com/entenschule/discrete_research.git (push)
    
  • 将远程仓库地址替换为SSH格式:

    git remote set-url origin git@github.com:entenschule/discrete_research.git
    
  • 再次验证远程地址已更新:

    git remote -v
    

    此时输出应变为SSH格式:

    origin  git@github.com:entenschule/discrete_research.git (fetch)
    origin  git@github.com:entenschule/discrete_research.git (push)
    
  • 重新执行推送命令即可使用SSH密钥认证:

    git push -u origin main
    

后续避免方案

后续克隆GitHub项目时,直接选择SSH格式的地址执行git clone命令,默认就会使用SSH密钥认证,无需再手动修改地址。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.14 20:25:02