解决 git 提交出现的 error:src refspec master does not match any.
问题
通常我们用git
往github
上提交项目或文件的时候通常是使用以下指令:
(1) 新建一个文件作为仓库根目录(文件名随意起)
(2) 将需要上传的东西放到此文件夹下
(3) git init ----- 初始化一个仓库
(4) git add . ----- 将所有文件添加到仓库
(5) git commit -m "first commit" ----- 提交
(6) git remote add origin git@github.com:YourName/YourRepositroy.git ----- 添加到源GitHub上
(7) git push -u origin master ----- 上传到源GitHub上
看似上面的方法不错,但是我在提交的时候一直出现以下错误:
原因是我执行过初始化命令后少了一步:git add README.md
。(原因我也不知道,求解求解,嘿嘿!!!!)
OK,在初始化仓库之后再提交一下 README.md
文件 ,只有继续运行从四开始的以下命令提交就成功了,nice。