今天做随机壁纸接口时用git上传项目时出现错误,错误如下:
git push -u origin master提示

error:src refspec master does not match any

  • 问题产生原因分析
    引起该错误的原因是,目录中没有文件,空目录是不能提交上去的,而且在push之前至少有过一次commit

  • 解决方法

git init 
git commit -m 'first commit'
git remote add origin https://github.com/xxx.github.io.git
git push -u origin master