git如何推送多个仓库

Git是一个开源的分布式版本控制系统,由Linus Torvalds创建,用于有效、高速地处理从小到大的项目的所有事务。它非常强大,能够从多个贡献者那里合并代码,同时保持项目历史的完整性。

env

  • gitee
  • codeup.aliyun.com

git在提交推送支持多个仓库

1.新建仓库

建议仓库名字一致

2.初始化仓库及pull

  • pass

3.添加密钥及测试

3.1在网站上添加可信密钥信息

3.2测试连通性
ssh -T git@codeup.aliyun.com
ssh -T git@gitee.com

4.修改.git/config

origin url是目标仓库地址

mvpbang@mvpbang blogs % cat .git/config 
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = git@github.com:xxx/blogs.git
    # 新增推送仓库地址
    url = git@codeup.aliyun.com:xxx/xxxx/blogs.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
    remote = origin
    merge = refs/heads/main

5.推送

git push
git push -f  //如果有问题则强制推送