将github仓库同步到gitee
    参考 ➠ 一次git同时提交到Github和Gitee
    在本地使用git提交时,会配置SSH密钥。这个密钥与github是一致的,否则也不会提交成功。那么将这个密钥也复制粘贴到Gitee的SSH公钥配置处,这样可以保证本地使用git可以提交到Gitee。
    其次在项目内的.git隐藏目录内,找到config文件,进行修改。起初是

    1. [core]
    2. repositoryformatversion = 0
    3. filemode = true
    4. bare = false
    5. logallrefupdates = true
    6. ignorecase = true
    7. precomposeunicode = true
    8. [remote "origin"]
    9. url = git@github.com:isgangzi/weigBlog.git
    10. fetch = +refs/heads/*:refs/remotes/origin/*
    11. [branch "main"]
    12. remote = origin
    13. merge = refs/heads/main

    修改后

    1. [core]
    2. repositoryformatversion = 0
    3. filemode = true
    4. bare = false
    5. logallrefupdates = true
    6. ignorecase = true
    7. precomposeunicode = true
    8. [remote "origin"]
    9. url = git@github.com:isgangzi/weigBlog.git
    10. url = git@gitee.com:isgangzi/weigBlog.git
    11. fetch = +refs/heads/*:refs/remotes/origin/*
    12. [branch "main"]
    13. remote = origin
    14. merge = refs/heads/main

    在原来的github仓库地址下面再添加一个url配置,指向gitee的地址。保存
    通过git config --list可查看刚刚是否修改正确
    此时再修改本地代码,不论「通过IDEA的git键提交」还是「通过命令行」都会同时提交到github和gitee。

    不觉得麻烦,使用手动同步也可以 登陆Gitee ➠ 关联Github账号 ➠ 右上角+号处同步Github项目到Gitee中