本地新项目如何上传到Git
2018-04-16 本文已影响0人
viky_lyn
经常在本地new一个新project,开发部分功能后,需要放到git上,因此有了本文~
前提条件:
1、本地有个project需要放到Git上;
2、假设已经有了Git的账号,也已经配置了SSH;
接下来就是具体的步骤了:
步骤一:
打开命令台;cd到project目录下,执行git init命令:

返回:Initialized empty Git repository in /Users/linliping/Desktop/JDBCode/createBug-yii/.git/ 代表成功了。
步骤二:
在project目录下,继续执行git add . 和git commit 命令:

成功了的话,就能看到一堆的提交信息啦。
步骤三:
在Git上new一个空的project:

输入项目名称,点击Create project:

步骤四:
在本地命令台继续输入:git remote add origin git@git.jdb-dev.com:linlp/createBug-yii.git

origin后面跟的是刚才新建项目的project地址
步骤五:
最后只要执行即可:git push -u origin master

over啦,可以回到Git上的项目里看,本地的内容确实都已经上传到Git上啦,而且以后就可以正常的执行 git push、git add、git commit、git pull 等命令了~