目前git的大平臺(tái)有國內(nèi)的gitee,國外的github
那么如何在本地倉庫同時(shí)上傳到這兩個(gè)平臺(tái)呢?
首先要在項(xiàng)目目錄下右鍵選擇Git Bash Here:
如果沒有Git Bash Here的話安裝地址:https://tortoisegit.org/download/
下面是具體操作:
//刪除?已關(guān)聯(lián)的名為origin的遠(yuǎn)程庫:
>git remote rm origin
//關(guān)聯(lián)gitee 的遠(yuǎn)程庫gitee_demo? 關(guān)聯(lián)git地址: https://gitee.com/xxx/demo.git
>git remote add gitee_demo https://gitee.com/xxx/demo.git
//關(guān)聯(lián)github 的遠(yuǎn)程庫github_demo? 關(guān)聯(lián)git地址: https://github.com/xxx/demo.git
>git remote add github_demo??https://github.com/xxx/demo.git
//查看本地庫連接的遠(yuǎn)程看
>git remote -v
會(huì)顯示:
gitee_demo git@gitee.com:xxx/demo.git(fetch)
gitee_demo git@gitee.com:xxx/demo.git(push)
github_demo git@github.com:xxx/demo.git(fetch)
github_demo git@github.com:xxx/demo.git(push)
//推送命令
//推送github:
>git push github_demo??master
//推送gitee:
>git push gitee_demo master
如果在sourcetree中右鍵master->推送到,? 就會(huì)發(fā)現(xiàn)有g(shù)ithub_demo以及gitee_demo的選項(xiàng)
然后選擇某個(gè)遠(yuǎn)程庫就會(huì)上傳到相應(yīng)的庫中,當(dāng)然上傳的過程中如果沒設(shè)置過賬號(hào)密碼,會(huì)彈出提示框重新設(shè)置下