git push --set-upstream origin master时超时失败的解决方案

发布时间:2024年01月18日

问题描述

提示:这里描述项目中遇到的问题:

git push --set-upstream origin master时,超时失败,显示如下错误:

connect to host git.acwing.com port 22:
Connection timed out fatal: Could not read from remote repository.  
Please make sure you have the correct access rights and the repository exists.

解决方案:

使用https协议,不要使用ssh协议

在你的git init的本地仓库目录,执行命令 git config --local -e
然后把里面的url配置项从git格式url = git@git.acwing.com:username/xx.git
修改为https格式url = https://git.acwing.com/username/xx.git
然后再执行git push --set-upstream origin master
输入git.acwing的账号名和密码就能成功git push到云端了。
**可以直接修改为https格式url = https://username:passwd@git.acwing.com/username/xx.git**这样就不用每次push都重新输入账号密码了

文章来源:https://blog.csdn.net/m0_52695557/article/details/135677808
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。