! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ‘https://github.com/linanyways/myProject.git’
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes
借鉴博客:https://blog.csdn.net/u013120247/article/details/53263169
这位大佬写的不错
上传本地文件到github的步骤
- 新建一个空文件夹或者在你要上传的文件夹里面右键使用
git bash here
- 之后就
git init
进行初始化本地仓库 git add ./
注意 “·” 不能省略,这步是暂存已修改文件git commit
提交更新git remote add origin github仓库的地址
添加远程仓库的地址git push -u origin master
(‘masters 是主分支,可以改成你自己的其他分支’),这里会要求你输入github
账号和密码- 到这里可能就会跟我一样报上面的错误了,尝试了很多种方法
- 使用
git pull origin master
报错之后就查了一下 - 使用
git pull --rebase origin master
之后再git push origin master
就可以啦。 - 上面那条命令的大致意思就是把远程库中的更新合并到本地库, --rebase的作用是取消本地库中刚刚的commit,并把它们连接到更新后的版本库之中。
- 使用