今天想把最近的一些代码push到码云上
先后运行:
git add .
git commit -m '一小段代码'
git remote add origin git@github.com:*****.git
在这一步git status
发现一些顺利,于是继续执行:
git pull origin master
git push -u origin master
发现报错:
To https://gitee.com/WgLiux/Vuelearn.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://gitee.com/WgLiux/Vuelearn.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
捣鼓半天又是撤销又是返回依然不行,明明pull过了,还提示git pull,想着是不是pull写错了,查资料后改成:
git pull --rebase origin master
然后再执行推送:
git push -u origin master
成功!
如果依然不行,可尝试git push -u origin master -f
强制push