1)创建忽略规则文件 xxxx.ignore(前缀名随便起,建议是 git.ignore)
这个文件的存放位置原则上在哪里都可以,为了便于让 ~/.gitconfig 文件引用,建议也放在用 户家目录下 git.ignore 文件模版内容如下: # Compiled class file *.class Version:0.9 StartHTML:0000000105 EndHTML:0000005946 StartFragment:0000000141 EndFragment:0000005906 # Log file *.log # BlueJ files *.ctxt # Mobile Tools for Java (J2ME) .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 .idea *.iml 2 )在 .gitconfig 文件中引用忽略配置文件(此文件在 Windows 的家目录中) [user] name = Layne email = Layne@atguigu.com [core] excludesfile = C:/Users/asus/git.ignore 注意:这里要使用“正斜线( / )”,不要使用“反斜线( )”


