将本地项目上传到github中,出现了
$ cd /d/project
$ pwd
$ git init
$ git remote add origin git@github.com:Jinkaiming/project.git
$ git push origin master
出现:
error: src refspec master does not match any.
error: failed to push some refs to'git@github.com:Jinkaiming/project.git'
原因:
第一个错误表示目录中没有文件
第二个错误表示要push一些东西上去
也就没有commit就push了
加上
$ git commit -m "first commit"
结果给出
nothing added to commit but untracked files present
去网上找了下,发现commit前必须有add
$ git add .
$ git commit -m "second commit"
$ git push origin master
OK,其中add . 是将所有文件都添加到远程仓库里