查看遠程origin地址:
git remote -v
刪除現有的origin地址 或 更新名稱:
git remote remove origin
git remote rename origin 新名稱
添加新的origin地址(新建的代碼托管地址):
git remote add origin 遠程地址
pull遠程代碼:
git branch --set-upstream-to=origin/<branch> master
git pull origin master --allow-unrelated-histories
正常提交本地代碼到新origin地址
有多個遠程地址時,提交之后需要push多個倉庫:
git pull 默認倉庫
git pull 遠程倉庫名稱 分支名稱
git add .
git commit -m ""
git push 默認倉庫
git push 遠程倉庫名稱 分支名稱
修改默認提交倉庫
git config --global user.name 你的英文名 git config --global user.email 你的郵箱 git config --global push.default simple current
must be one of nothing, matching, simple, upstream or current
git config branch.master.remote 默認提交的倉庫名稱