git同步更新GitHub和码云
首先github和码云上的仓库都要建好。然后将其中一个仓库clone到本地
git clone XXXXX修改.git里面的配置文件config
[core]repositoryformatversion = 0filemode = falsebare = falselogallrefupdates = truesymlinks = falseignorecase = true[remote "github"]url = https://github.com/****/notefetch = +refs/heads/*:refs/remotes/origin/*# 添加码云的url[remote "gitee"]url = https://gitee.com/****/notefetch = +refs/heads/*:refs/remotes/origin/*[branch "master"]remote = origin merge = refs/heads/master
提交代码时
git add .git commit -m "update"#提交到githubgit push github master#提交到码云git push gitee master
拉取更新时
#从github拉取更新git pull github#从码云拉取更新git pull gitee如果很少拉取更新或者嫌上面这个麻烦可以
[core]repositoryformatversion = 0filemode = falsebare = falselogallrefupdates = truesymlinks = falseignorecase = true[remote "origin"]url = https://github.com/****/note# 在这里添加码云的urlurl = https://gitee.com/****/notefetch = +refs/heads/*:refs/remotes/origin/*[branch "master"]remote = originmerge = refs/heads/master
这样提交时只用git push origin master,不用分别提交。
评论
