1.(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库。
git init
2.把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点“.”,意为添加文件夹下的所有文件(夹)。
git add .
3.commit到主分支
git commit -m "描述"
4.登录github,把本地仓库提交至远程仓库。
接下来你要做的就是复制那个地址,然后你将本地仓库个远程仓库连接起来。
git remote add origin git@github.com:yourname/仓库名.git
5.进行第一次提交
git push -u origin master
ps: windows系统中使用git时报错“warning: LF will be replaced by CRLF”解决方案:

$ rm -rf .git // 删除.git
$ git config --global core.autocrlf false //禁用自动转换 //然后重新执行 $ git init
$ git add .

rm -rf .git慎用!!!!原因详见:https://www.zhihu.com/question/29438735 不小心敲了rm -rf后反应是怎样的?
怕什么真理无穷,进一寸有一寸的欢喜。