同一份代码提交到多个远程仓库(Gitee/GitHub)

BBigSun 评论310阅读模式

1、克隆代码到本地

git clone https://gitee.com/bbigsun/docsify-template.git

克隆到本地,默认标签名称为 origin

origin  https://gitee.com/bbigsun/docsify-template.git (fetch)
origin  https://gitee.com/bbigsun/docsify-template.git (push)

修改标签名称文章源自十年又十年-https://www.bbigsun.com/216.html

git remote rename origin gitee


2、连接远程仓库

连接 Gitee 远程仓库文章源自十年又十年-https://www.bbigsun.com/216.html

git remote add gitee https://gitee.com/bbigsun/docsify-template.git

连接 GitHub 远程仓库文章源自十年又十年-https://www.bbigsun.com/216.html

git remote add github https://github.com/bbigsun/docsify-template.git

查看当前远程仓库文章源自十年又十年-https://www.bbigsun.com/216.html

git remote -v


4、提交代码

提交代码到 Gitee文章源自十年又十年-https://www.bbigsun.com/216.html

git push gitee master

提交代码到 GitHub文章源自十年又十年-https://www.bbigsun.com/216.html

git push github master


5、拉取代码

从 Gitee 拉取代码到本地文章源自十年又十年-https://www.bbigsun.com/216.html

git pull gitee master

从 GitHub 拉取代码到本地文章源自十年又十年-https://www.bbigsun.com/216.html

git pull github master

PS:由于代码相同,拉取一次即可文章源自十年又十年-https://www.bbigsun.com/216.html 文章源自十年又十年-https://www.bbigsun.com/216.html

纸上得来终觉浅,绝知此事要躬行。

weinxin
17688689121
我的微信
微信扫一扫
BBigSun
  • 本文由 BBigSun 发表于 2023年 2月 7日 09:15:38
  • 转载请务必保留本文链接:https://www.bbigsun.com/216.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定