場景:備份GitHub代碼倉庫到國內倉庫gitee.com php
目的: 當GitHub沒法訪問時,可以訪問國內倉庫國內倉庫gitee.com 。 html
Solution: android
Login In https://gitee.com/, use '"Import Respository"' to import project from github to gitee.git
List all project form GitHub. Then choose to import project. github
Wait for a minute, import successfully.fetch
Scenario:When Github android-art-res.git code updated,how to sysnchronize code to gitee ?this
Sample:
https://gitee.com/YingVickyCao/android-art-res.git
https://gitee.com/YingVickyCao/android-art-res.giturl
In gitee project page,Click 'fresh' button, force sysnchronizing from github project.
Wait for a minute, sysnchronize successfully.spa
Sample:
git@gitee.com:YingVickyCao/android-about-demos.git
git@github.com:YingVickyCao/android-about-demos.git.net
# In terminal,cd project dir. # 添加一個名爲 both 的遠端 $git remote add both git@gitee.com:YingVickyCao/android-about-demos.git # 爲其添加 push 到 gitee.com 的 SSH 地址 $git remote set-url --add --push both git@gitee.com:YingVickyCao/android-about-demos.git # 爲其添加 push 到 GitHub 的 SSH 地址 $git remote set-url --add --push both git@github.com:YingVickyCao/android-about-demos.git #查看當前遠端倉庫 $git remote -v both git@gitee.com:YingVickyCao/android-about-demos.git (fetch) both git@gitee.com:YingVickyCao/android-about-demos.git (push) both git@github.com:YingVickyCao/android-about-demos.git (push) origin git@github.com:YingVickyCao/android-about-demos.git (fetch) origin git@github.com:YingVickyCao/android-about-demos.git (push)
In project .git/config file, we can "both" add successfully.
# modify code $ git add . $ git commit -m "test code" $ git push both Warning: Permanently added the RSA host key for IP address '192.30.255.112' to the list of known hosts.
警告:爲IP地址192.30.255.112的主機(RSA鏈接的)持久添加到hosts文件中
192.30.255.112 是什麼地址?
http://www.ip.cn/index.php?
PS:
若是更改,只須要更改config文件裏,那三個url的順序便可,fetch-url會直接對應排行第一的那個utl鏈接。
No.
感謝Reference
中各位做者的無私貢獻.
歡迎你們留言、指點、交流。