git使用相关

今天在github上创建repository后,然后在本地clone,一切正常,然后高高兴兴的敲着代码,完了之后去提交,结果悲剧了,报错如下:

1
2
3
4
5
6
error: failed to push some refs to '[email protected]:wk5683/ToolbarDemo.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushi
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.

好吧,既然有错(bug)那就要去找了,在提交之前已经关联成功的了,百度一下说是远程README不再本地,需要执行命令,
执行

1
git pull --rebase origin master

然后执行git push,ok提交成功。