执行git push时出现Perhaps you should specify a branch such as 'master'.的错误

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_37281289/article/details/87451526

项目中第一次执行git oush 操作有时会出现如下报错:

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to '/home/pro.git'

出现如上的错误, 有可能就是你没有指定要push到那个分支, 导致git 也不知所措了.

所以只要git push /home/pro.git master              //这样就能成功将代码push到master 分支上

上句代码的 /home/pro.git 为你要push的地址, master 为你要push的分支,一般都会是push到master分支上

猜你喜欢

转载自blog.csdn.net/weixin_37281289/article/details/87451526