1. 先在github网站创建一个仓库
2. 在本地项目目录下创建本地仓库 git init
3. 将本地项目目录下所有文件提交到本地暂存区 git add . # 查看提交状态命令 git status
4. 将本地暂存区文件提交到本地仓库 git commit -m "注释"
5. 将本地项目仓库提交到github服务器仓库暂存区 git remote add origin https://github.com/用户名/仓库名 #也可以使用SSH
6. 先将远程服务器仓库的内容拉下来 git pull orgin master # 若fatal:拒绝合并无关的历史, 就后加参数 --allow-unrelated histories
7. 提交到Github仓库 git push -u origin master
一个流程以后,再添加要上传到Github的文件,只需在这个目录仓库下
git add .
git commit -m "注释"
git push
附: git教程
https://backlog.com/git-tutorial/cn/intro/intro1_1.html