推送至GitHub时遇https相关问题及远程仓库设置错误求助
解决Git推送GitHub及远程仓库设置错误
一、处理「fatal: No such remote 'demography'」错误
- 错误原因:执行
git remote set-url demography ...时,指定的远程仓库名demography不存在——你此前通过git remote add origin ...添加的远程仓库默认名称是origin,而非demography。 - 解决步骤:
- 查看当前已配置的远程仓库列表,确认名称:
git remote -v - 若需修改远程仓库URL,针对已存在的
origin执行正确命令:git remote set-url origin https://github.com/baweezy02/demography.git - 再次执行
git remote -v,确认URL修改成功。
- 查看当前已配置的远程仓库列表,确认名称:
二、处理「Unable to find help for https-」推送错误
该错误多与Git HTTPS配置、网络环境相关,可按以下步骤排查:
- 检查并清理无效代理配置:
先查看当前代理设置:
若存在不需要或错误的代理,执行清除:git config --global --get http.proxy git config --global --get https.proxygit config --global --unset http.proxy git config --global --unset https.proxy - 配置Git凭证助手,避免重复认证:
git config --global credential.helper store - 重新尝试推送:
git push -u origin master - 若HTTPS协议仍有问题,可切换为SSH协议(需提前在GitHub配置SSH密钥):
git remote remove origin git remote add origin git@github.com:baweezy02/demography.git git push -u origin master
内容的提问来源于stack exchange,提问作者Bawo Agbarajor
相关产品推荐
相关产品推荐

