建立本地仓库
1.首先进入text文件夹
cd d:text
![](http://upload-images.jianshu.io/upload_images/3067059-2b398f0122f722cb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
首先进入text文件夹
2.执行指令:git init
![](http://upload-images.jianshu.io/upload_images/3067059-71817641532ad828.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
执行git init
初始化成功后你会发现项目里多了一个隐藏文件夹.git
![](http://upload-images.jianshu.io/upload_images/3067059-ac953ff8977c72db.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
隐藏的文件夹
3.执行指令:git add .
将所有文件添加到仓库
![](http://upload-images.jianshu.io/upload_images/3067059-fd5b779ebc45f4ba.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
执行git add .
4.执行指令:git commit -m "提交文件"
双引号内是提交注释。
![](http://upload-images.jianshu.io/upload_images/3067059-b4be356b146b06ff.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
提交文件
2.5.3 关联github仓库
1.到github text仓库复制仓库地址
![](http://upload-images.jianshu.io/upload_images/3067059-29c5089e9fd4b637.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
复制仓库地址
2.执行指令:git remote add origin https://github.com/hanyuntao/text.git
![](http://upload-images.jianshu.io/upload_images/3067059-eeaf4b58df1f142f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2.5.4 上传本地代码
执行指令:git push -u origin master
![](http://upload-images.jianshu.io/upload_images/3067059-22f6fe754c8e3267.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
执行指令
2.5.5完成了
可以看到我们的本地项目已经上传到了github上了。
![](http://upload-images.jianshu.io/upload_images/3067059-2b4264842851800a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
完成了
注意:git是不能管理空的文件夹的,文件夹里必须有文件才能上传。