1、在要上传的目录下
git init
touch README.md
2、设置gitignore
gedit .gitignore
# Eclipse
.classpath
.project
.settings/
# Intellij
.idea/
*.iml
*.iws
target/
# Mac
.DS_Store
# Maven
log/
target/
3、添加文件
git add README.md
git add .gitignore
4、本地提交
git ci -m 'init'
5、push到github分支
git remote add origin https://github.com/username/projectname.git
git push origin master