git更新遠程地址

1、git 刪除遠程地址

git remote rm origin

 

2、git 更換遠程地址

git remote add origin http://10.00.3.260:10080/xxxxxx/sxxxy.git/

 

3、把當前分支與遠程分支進行關聯(branchname要改成你的當前分支名稱)

git push --set-upstream origin branchname

1) 報錯信息:

To http://192.168.0.176:9000/dfas_group/dfas_cloud_core/dfas-monitor.git
 ! [rejected]        dev -> dev (fetch first)
error: failed to push some refs to 'http://192.168.0.176:9000/dfas_group/dfas_cloud_core/dfas-monitor.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 2)報錯信息

To http://192.168.0.176:9000/dfas_group/dfas_cloud_core/dfas-monitor.git
 ! [rejected]        dev -> dev (non-fast-forward)
error: failed to push some refs to 'http://192.168.0.176:9000/dfas_group/dfas_cloud_core/dfas-monitor.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

解決辦法:先fetch->pull->push,

最後執行第3步

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章