写完一部分实验,第一次push到github上时使用:
git push -u origin master
但当第二次push时总会报错
error: failed to push some refs to ‘git@github.com:你的远程库名.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,进行合并然后在进行push,
git pull --rebase origin master
git push -u origin master
但是我用这个仍然有一些问题,所以我用了
git push -u origin master -f
强制上传到远程服务器,但是目录会有些问题。但是实验目录较为简单,还可以改回来。