您的位置:首页 > 其它

git设置全局忽略文件

2016-10-20 18:14 330 查看
项目传到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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git 全局忽略