gitlab无法读取远程仓库_Git push到远程gitlab报错问题

问题描述:

无法实现push操作到gitlab的远程仓库

问题产生流程:

远程仓库地址变更

执行了命令:git remote rename origin old-origin

git remote add origin git@53b2231cd9de:root/translate.git

异常提示(执行 git push -u origin master):ssh: connect to host 127.0.0.1 port 22: Connection refusedfatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.

问题解决:git remote set-url origin http://127.0.0.1:32767/root/translate.git

设置远程url地址使用http协议,不再使用SSH协议

备注:

这个问题产生的原因应该是docker虚拟出来的端口映射,把22映射成32776导致的,

再使用SSH做clone或push的时候直接走22端口,实际上SSH应该走32776端口。

在解决问题的过程中,以为是端口的问题,却没有注意所采用的协议是什么,写法类似

git@xxxx.com:root/translate.git是SSH协议的写法,后采用http协议后问题

轻松解决(http://127.0.0.1:32767/root/translate.git)。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值