项目传到git的时候只需要src,pom.xml,但是导入eclipse时候,会产生一些配置文件,比如.classpath,.project等文件,如果每个项目都去设置一遍ignore太麻烦了,所以从全局设置忽略文件,就不用每个项目都设置了。
1,在eclipse的工作空间(workspace)新建.gitignore文件,文件内容:
/bin/
/target/
.classpath
.gitignore
.project
.settings/
2,执行忽略文件全局配置的命令:
git config --global core.excludesfile ~/git_repository/.gitignore
执行完以上命令后再执行git status,发现git工作空间干净的,说明全局变量配置成功
evan@evan:~/git_repository/srs$ git status
On branch test
Your branch is up-to-date with 'origin/test'.
nothing to commit, working directory clean