1、首先在本地创建仓库,VCS --> Import into Version Control --> Create Git Repository
2、在根目录下添加 .gitignore 文件忽略不必要的文件
# Created by .ignore support plugin
*.class
target/
*.iml
.idea/
logs/
.classpath
.project
.settings/
.amateras
/target*
*.log*
*.lock
git add .gitignore
git status --ignored,查看状态,包括忽略的文件
git rm -r --cached . 清除缓存(清除之前 git add 的缓存) -r 表示递归删除 (如果有文件夹的话) . 表示所有文件
3、git add 将所有文件都添加到本地,然后 commit 到本地仓库
4、Git --> remote 添加远程仓库的地址
5、git push 完事