Git报错Perhaps you should specify a branch such as ‘master’.

  • A+
所属分类:未分类

Git报错Perhaps you should specify a branch such as 'master'.

使用git push进行提交的时候出现如下错误

[xxx@xxxxxx xxxx]$ git push
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
remote:
remote: Your Git command did not succeed.
remote: Details:
remote:         TF401041: The Git protocol sent is not as expected (Unable to read the 4-byte length header of the message.).
remote:
Everything up-to-date

出现的原因

没有指定本地分支

解决方法

  • 先查看是否有本地分支
$ git branch

如果本地分支是空的话,则先进行一次提交

$ git add -A
$ git commit -m "Init"
  • 指定提交分支
git push origin master
百分购

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: