Git 如何将本地仓库和远程仓库关联

1.本地操作如下,

git init
git remote add origin [email protected]:YotrolZ/helloTest.git
git push -u origin master

2.如果push不成功,两种解决方式,

(1)先拉取,忽略历史

    git pull origin master --allow-unrelated-histories
    git push

(2)强制上传,慎用,会覆盖

git push -u origin master -f 

参考:本地Git仓库和远程仓库的创建及关联

Git提交失败之 Updates were rejected because the tip of your current branch is behind

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