master->master报错解决办法

git将本地库push到github远程库失败

  • git push -u origin master失败,报错如下
    • 问题原因
      • 仓库中的代码和本地中的代码不一致
    • 解决办法
      • 将仓库里的代码pull下来:git pull https://github.com/---------------------------.git master
      • 执行git add . && git commit -m " ---" && git push https://github.com/---------------------------.git master
    • 成功结果如下
    • 参考大神

git push -u origin master失败,报错如下

000@000:~/DMU_ASV_ROS$ git push -u origin master
To [email protected]:--------------------------------------.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘[email protected]:----------------------------------------.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.

问题原因

仓库中的代码和本地中的代码不一致

解决办法

将仓库里的代码pull下来:git pull https://github.com/---------------------------.git master

执行git add . && git commit -m " —" && git push https://github.com/---------------------------.git master

成功结果如下

master->master报错解决办法_第1张图片

参考大神

你可能感兴趣的:(git)