前端有道 前端有道
导航
算法
开发
  • Git

    • Git导读
  • 收藏夹 (opens new window)
  • 工具库 (opens new window)
  • netlify Vuepress (opens new window)
  • vercel Vuepress (opens new window)
  • Vuepress2.0 (opens new window)
  • netlify Vuepress2.0 (opens new window)
留言区
娱乐
关于
  • 时间轴
  • 标签
  • 分类

星野

给岁月以文明
导航
算法
开发
  • Git

    • Git导读
  • 收藏夹 (opens new window)
  • 工具库 (opens new window)
  • netlify Vuepress (opens new window)
  • vercel Vuepress (opens new window)
  • Vuepress2.0 (opens new window)
  • netlify Vuepress2.0 (opens new window)
留言区
娱乐
关于
  • 时间轴
  • 标签
  • 分类
  • 浏览器

  • Git

    • Git导读
    • 常用Git命令清单
    • Git思维导图
    • Git分支开发模型规范
    • 图解Git
    • Git变基合并
    • Git 在 macOS 中忽略所有 .DS_Store 文件
    • Git本地仓库关联多个远程仓库
      • 前言
        • set-url命令
        • 修改.git文件
    • Git Commit表情大全
    • permissions 0755 问题解决
  • Mac

  • VSCode

  • GitHub

  • 工具
  • Git
星野
2021-7-28
0
目录

Git本地仓库关联多个远程仓库

# 前言

有一个公司的项目,可能是通过公司的内网搭建的GitLab,但是自己又想偷偷保存到自己私密仓库上,以备不时之需,这时我们只需要这样做就行。

例如我们两个仓库:

https://gitee.com/qqlcx5/frontend.git // 仓库一
https://github.com/qqlcx5/frontend.git // 仓库二

# set-url命令

关联第一个仓库:

git remote add origin https://gitee.com/qqlcx5/frontend.git

关联多个远程仓库:

git remote set-url --add origin https://github.com/qqlcx5/frontend.git

推送到多个远程仓库:

git push origin --all

# 修改.git文件

在项目中,git初始化后都有一个.git文件夹的隐藏文件,通过编辑器打开.git/config文件后

可以看到这样的配置:

[remote "origin"]
url = https://gitee.com/qqlcx5/frontend.git
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://github.com/qqlcx5/frontend.git // 新增远程仓库

大功告成。

#Git
上次更新: 2022/05/10, 16:56:01
Git 在 macOS 中忽略所有 .DS_Store 文件
Git Commit表情大全

← Git 在 macOS 中忽略所有 .DS_Store 文件 Git Commit表情大全→

最近更新
01
图解Git
05-10
02
关于 - 网站错误反馈
05-10
03
关于 - 赞赏❤️的用途
05-10
更多文章>
加入前端有道交流群 | Copyright © 2018-2025 星野 | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式