创建自己的github代码库

前提:

  1.安装git

  2.在github上创建一个repository(库),如名字叫Hello-World,则git地址为https://github.com/username/Hello-World.git

  3.创建一个项目,如Hello-World

步骤:

  1.cd Hello-World 切到你的项目目录下

  2.git init 初始化

  3.git add . 将文件添加到等待提交的文件列表中,注意add后面的.代表全部,也可以指定特定的文件,如git add readme.txt

  4.git commit -m '修改说明' 提交到local库

  5.git remote add origin https://github.com/username/Hello-World.git 创建github库(仅创建库时需求,再修改提交不需要此步)

  6.git push origin master 将你提交到local库的文件push到master分支

  参考https://help.github.com/articles/create-a-repo

遇到的问题(已解决):

  1.只进行了init,没有add,也没有commit就进行提交,会提示“error:src refspec master does not match any

  2.push时提示要先pull,则git pull origin master

待解决问题:

  1.每次push时需要输入用户名和密码

  2.怎么自动将项目中不需要提交的文件忽略掉,如node_modules里的文件

 

 

posted @ 2014-06-12 17:10  Emma.  阅读(549)  评论(1编辑  收藏  举报