GIt 同时绑定 GItee 与 Github 进行 push 操作

1 GIt 同时绑定 GItee 与 Github 进行 push 操作

1) 查看远程仓库

查看下当前项目的远程仓库

git 复制代码
git remote

查看绑定的远程仓库

该命令会显示读写远程仓库的名称和地址,指向仓库为 Github。

cmd 复制代码
git remote -v
>>>
origin  https://github.com/yanSir/demos.git (fetch)
origin  https://github.com/yanSir/demos.git (push)

2) 远程仓库重命名

修改远程仓库名称

cmd 复制代码
git remote rename <old_remote> <new_remote>
git remote rename origin github

查看远程仓库

cmd 复制代码
git remote -v
>>>
github  https://github.com/gozhuyinglong/blog-demos.git (fetch)
github  https://github.com/gozhuyinglong/blog-demos.git (push)

3) 添加另一个远程仓库

添加远程仓库命令

添加Gitee上的远程仓库,在Gitee上创建一个同名的仓库,在【克隆】处复制地址。

cmd 复制代码
git remote add <remote> <url>
git remote add gitee https://gitee.com/gozhuyinglong/blog-demos.git
>>>
gitee   https://gitee.com/gozhuyinglong/blog-demos.git (fetch)
gitee   https://gitee.com/gozhuyinglong/blog-demos.git (push)
github  https://github.com/gozhuyinglong/blog-demos.git (fetch)
github  https://github.com/gozhuyinglong/blog-demos.git (push)

4) 多个远程仓库的推送/拉取

多个远程仓库 push 与 pull 的命令

cmd 复制代码
git push <remote> <branch>、git pull <remote> <branch>:
git push github main
git pull github main
git push gitee main
git pull gitee main

5) 移除一个远程仓库

移除远程仓库命令

执行移除远程仓库后,该仓库在本地的所有分支与配置信息也会一并删除。

cmd 复制代码
git remote remove <remote> | git remote rm <remote>
git remote remove gitee
相关推荐
wflynn9 分钟前
GitHub 今日推荐|xcl:在 Windows PC 上直接运行 Xbox Series X|S 游戏
rust·开源·github·d3d12·gdk·rdna2
逛逛GitHub23 分钟前
本周 TOP 11 排名的 GitHub 开源项目大盘点,看看能用到哪些。
github
用户69371750013842 小时前
AI 用久了,我发现自己越来越不想找人聊天了
前端·后端·github
凉、介3 小时前
Git 深入理解(二) | 常用命令
大数据·git·elasticsearch
怕浪猫13 小时前
NVIDIA 全产品谱系与演进
javascript·面试·github
一条Go14 小时前
Grafana 面板嵌入:为什么 kiosk 必须是「裸参数」
后端·github
一条Go14 小时前
开源新生代雷达 · 第 20 期
github
71777715 小时前
大型企业研发平台选型:Gitee 与四类主流方案的对比与落地路径
gitee
小帅不太帅17 小时前
一年一次黑五,为了买软件真省钱,我做了个开源小站
前端·人工智能·github
用户693717500138419 小时前
AI 帮我写了大半年的代码,我却越来越不会写代码了
前端·后端·github