在使用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 ""
清除代理
为什么不直接用https://github.com/...?
类似的问题,如果你的仓库为空或者只有几个readme之类的文件。但是你又想把本地的代码推到github上去,你就直接使用 git push origin master:master --force
命令说明如下
--force
的意思是强制提交,并覆盖远程仓库的代码
如果你本地有源文件的话 ,建议重新创建一个gitlab项目,然后源文件重新上传,不建议纠结现有的配置做了调整。
尝试 git config --global http.proxy "" 清除代理
远程仓库url不对,后面是什么勾玩意儿