解决! [rejected] master -> master (fetch first)

在提交一个很久没有更新过的项目时,遇到了下面这个问题

! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘https://github.com/faimi/my-react.git’
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.

解决! [rejected] master -> master (fetch first)_第1张图片
解决办法是:先pull再重新push
(1)git pull --rebase origin master
解决! [rejected] master -> master (fetch first)_第2张图片
(2)git push -u origin master
解决! [rejected] master -> master (fetch first)_第3张图片
注意git Bash的复制粘贴:

Ctrl+ins 复制
Shift+ins 粘贴

你可能感兴趣的:(Git,git)