git init #在当前目录创建一个新的代码库
git add README.md #添加readme.md文件
git commit -m '此处添加上传内容书名' #提交暂停区到仓库
##开始添加远程仓库地址
git remote add origin 远程仓库地址
##提交代码到远程仓库去
git push -u origin master
一搬情况下提交到这一步第一次提交都会出现报错
! [rejected] master -> dev-gaochao (fetch first)
error: failed to push some refs to '...........'
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.
一脸蒙蔽,本来开开心心以为终于提交成功,原来成功的大门口还有一个坑 不得不跳的坑!废话不多说,出现这个报错大概原因就是因为你在创建远程仓库的时候创建了README.md文件,然后你上传的本地文件夹没有这个文件,所以出现这个报错信息
这个报错信息我统计了一下一共有两种解决办法
第