04 ecilpse中配置git忽略项目配置文件和目标文件

(1)在项目中,有些文件是不能被提交到版本库的,比如项目的eclipse配置文件,生成的目标文件等,这些无用文件如果提交到版本库,会给团队的其他人带来麻烦,环境的差异导致项目运行失败,以及生成的目标文件是多余的

 (2)我们需要全局设置下,让git忽略掉这些文件,首先创建一个文本文件,输入以下内容

# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.classpath
.project
.settings
target
build
.gitignore
META-INF

(3)找到本地.gitconfig目录,在同目录下,复制并粘贴Java.gitignore到该目录,再打开.gitconfig文件加下配置:

[user]

  name = java1234

  email = java1234@qq.com

[core]

    excludesfile = C:/Users/Administrator/Java.gitignore

 重启eclipse restart,如图所示,即为成功

 

 (4)只显示该显示的文件

 

posted @ 2021-07-30 10:59  Lemon1103  阅读(314)  评论(0编辑  收藏  举报