mac下git无法提交代码

1.私有服务器搭建的环境,先clone下来了

git add .
git commit -m "提交"
git push
xxx@xxx.xx.xxx.xxx's password:
To 47.92.137.186:/xx/xx/xx.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'xx@xxx.xx.xxx.xxx:/xx/xx/xx.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.

就这样了...
第一次提交就这样的!!...
一直用的一个公钥!!!

阅读 4.3k
4 个回答

怪我怪我,问题没问清楚,要是能pull下来我还会问么???
原因是node_modules这个文件夹和文件夹里面的内容不能提交!!

好好看看错误提示

hint: 'git pull ...') before pushing again.

先git pull ,再 git push

认认真真看提示内容

远程分支上存在本地分支中不存在的提交,往往是多人协作开发过程中遇到的问题,可以先fetch再merge,也就是pull,把远程分支上的提交合并到本地分支之后再push。

如果你确定远程分支上那些提交都不需要了,那么直接git push origin master -f,强行让本地分支覆盖远程分支。。。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题