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

你可能感兴趣的:(Git)