编程知识 cdmana.com

Set git to push gitee and GitHub remote warehouses at the same time

Because at home github Often inaccessible , At the same time, support domestic enterprises , So I recently started using gitee, But also want to push the project synchronously , I don't want to push it manually every time 2 Time .

  1. Get into .git Under the table of contents , open config file , The default file contents are as follows
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = https://gitee.com/geekidentity/showcase.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
  1. Just in [remote "origin"] Add other to push git Address , for example github Or your own gitlab

url = https://github.com/geekidentity/showcase.git

The editing is completed as follows :

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = https://gitee.com/geekidentity/showcase.git
        url = https://github.com/geekidentity/showcase.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

Push again at this time git push, You will press url Push... In sequence .

版权声明
本文为[Hou fachao]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/10/20211002145417972w.html

Scroll to Top