Github 如何和 Gitee 進行同步?
首先關聯Github和Gitee的遠端倉庫;
git remote add github git@github.com:code/demo.git git remote add gitee git@gitee.com:code/demo.git
然後開啟「.git」資料夾內的設定檔;接著修改remote改兩個,一個Github函式庫另一個Gitee函式庫;
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = git@github.com:chloneda/demo.git fetch = +refs/heads/*:refs/remotes/github/* [branch "master"] remote = origin merge = refs/heads/master
將上述文件內容[remote "origin"]內容複製,修改origin名稱,內容如下:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "github"] url = git@github.com:chloneda/demo.git fetch = +refs/heads/*:refs/remotes/github/* [remote "gitee"] url = git@gitee.com:chloneda/demo.git fetch = +refs/heads/*:refs/remotes/gitee/* [branch "master"] remote = origin merge = refs/heads/master
最後程式碼分別提交到Github和Gitee即可。
提交到github
git push github master
提交到碼雲
git push gitee master
推薦教學:《Git教學》
以上是Github 如何和 Gitee 進行同步?的詳細內容。更多資訊請關注PHP中文網其他相關文章!