关联本地git库到github远程库
2017-02-14 本文已影响0人
runner123
场景:我们在本地已经创建了git版本库,需要提交到远程库
第一步:在GitHub上创建远程库

第二步:创建完成后,根据git提示,由于是关联本地到远程,执行如下命令:
> git remote add origin https://github.com/lizan2013/test.git
> git push -u origin master(仅限第一次提交,之后提交执行:
git push origin master)

注意:如果在关联的时候本地库没有文件,会报错:error: src refspec master does not match any.

需要通过git add file ,git commit -m "init" 来提交页面,再执行push推送到远程