美文网首页
生信技巧每日分享day20-将仓库同时推送到github和git

生信技巧每日分享day20-将仓库同时推送到github和git

作者: 江湾青年 | 来源:发表于2023-03-12 11:33 被阅读0次

    如何将仓库同时推送到github和gitee呢?

    编辑.git目录下的config文件,给[remote "origin"]下面添加两行

            url = git@gitee.com:Telogen/Journal-Phenomics.git
            fetch = +refs/heads/*:refs/remotes/origin/*
    

    即:

    [core]
            repositoryformatversion = 0
            filemode = true
            bare = false
            logallrefupdates = true
    [remote "origin"]
            url = git@github.com:Telogen/Phenomics.git
            fetch = +refs/heads/*:refs/remotes/origin/*
            url = git@gitee.com:Telogen/Journal-Phenomics.git
            fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "master"]
            remote = origin
            merge = refs/heads/master
    

    这样使用git push的时候只需push一次即可


    如果为了避免冲突,可进行两个remote的命名,即:

    [core]
            repositoryformatversion = 0
            filemode = true
            bare = false
            logallrefupdates = true
    [remote "github"]
            url = git@github.com:Telogen/Phenomics.git
            fetch = +refs/heads/*:refs/remotes/origin/*
    [remote "gitee"]
            url = git@gitee.com:Telogen/Journal-Phenomics.git
            fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "master"]
            remote = origin
            merge = refs/heads/master
    

    这样,push时就需要分别进行两次

    git push github matser 
    git push gitee master  
    

    参考

    https://blog.csdn.net/weixin_44893902/article/details/125147574

    相关文章

      网友评论

          本文标题:生信技巧每日分享day20-将仓库同时推送到github和git

          本文链接:https://www.haomeiwen.com/subject/tbdtrdtx.html