git pull、git push命令的时候报错

问题遇到的现象和发生背景

在使用Hugo+Github搭建博客时,使用git命令出现问题。其实这个问题以前也有:git clone、git pull、git push命令的时候报错

用代码块功能插入代码,请勿粘贴截图

git pull origin master
git push -u origin master

运行结果及报错内容

fatal: unable to access 'https://gitclone.com/github.com/账户名/账户名.github.io.git/': Failed to connect to localhost port 5000 after 150222 ms: Connection refused

我的解答思路和尝试过的方法

1.改master为main
2.重新设置SSH key

我想要达到的结果

git 命令运行成功

请看这篇博客
https://blog.csdn.net/qq_31193221/article/details/116661393

Failed to connect to localhost port 5000 after 150222 ms: Connection refused

你是不是配置过代理,然后代理挂掉了。尝试 git config --global http.proxy "" 清除代理

img

为什么不直接用https://github.com/...?

类似的问题,如果你的仓库为空或者只有几个readme之类的文件。但是你又想把本地的代码推到github上去,你就直接使用 git push origin master:master --force
命令说明如下

img

--force 的意思是强制提交,并覆盖远程仓库的代码

如果你本地有源文件的话 ,建议重新创建一个gitlab项目,然后源文件重新上传,不建议纠结现有的配置做了调整。

希望有用
https://b23.tv/1mw6q3z

尝试 git config --global http.proxy "" 清除代理

远程仓库url不对,后面是什么勾玩意儿

img