gitlab更换服务器需要重新指定关联的远程分支

例:远程分支
http://xxx.xxx.xxx.xxx/contt/webcontt.git 或
git@xxx.xxx.xxx.xxx:contt/webcontt.git

设置git 用户名和邮箱(其实也可以不用再设置)
git config --global user.name ‘userName’
git config --global user.email ‘email账号’

切换gitlab 仓库
git remote remove origin
git remote add origin git@xxx.xxx.xxx.xxx/:contt/webcontt.git

设置gitlab 仓库
git remote set-url origin git@github.com:xxxxxx/xxxxx.git

找到秘钥文件
C:\Users\userName.ssh\id_rsa.pub

切换仓库后,确保 .ssh\known_hosts 文件的ip已修改

更新ssh秘钥 一路 Enter
ssh-keygen -t rsa -C ‘email账号’

验证密钥是否配置成功
ssh -T git@github.com

如果在没有关联且没有指定分支的情况下,可以使用下面命令指定:
将远程的origin/master 分支和 本地的master分支建立连接
关联的目的是为了在本地进行pull和push时不需要再次指定远程分支
git branch --set-upstream-to=origin/master master

再重新提交下就可以了
git push -u origin testDev

设置代理
git config --global http.proxy ‘http://127.0.0.1:9083’
git config --global https.proxy ‘http://127.0.0.1:9083’
https代理和ssh代理:https://zhuanlan.zhihu.com/p/481574024

取消代理
git config --global --unset http.proxy ‘http://127.0.0.1:9083’
git config --global --unset https.proxy ‘http://127.0.0.1:9083’

查看代理
git config --global --get http.proxy ‘http://127.0.0.1:9083’
git config --global --get https.proxy ‘http://127.0.0.1:9083’

查看git 的一些命令
git help -a

查看git的全局配置和当前项目配置
git config --list

访问git 所需要的梯子
https://blog.csdn.net/qq845484236/article/details/109499575

远程代码托管平台–GitHub、Gitee的使用
https://blog.csdn.net/m0_62391199/article/details/125551906?utm_medium=distribute.pc_relevant.none-task-blog-2defaultbaidujs_baidulandingword~default-4-125551906-blog-109499575.235v27pc_relevant_3mothn_strategy_recovery&spm=1001.2101.3001.4242.3&utm_relevant_index=7

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值