git设置全局忽略文件

项目传到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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值