新建文件.gitignore,粘贴以下代码,将.gitignore文件粘贴在.git文件夹同等级目录下,上传就不会有太乱的了

# Compiled class file
*.class

.idea/
*.iml
target/

# 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*

注意:忽略文件写入该目录后才生效,对之前已被上传的target包,忽略文件将使在之后的更新版本中本地仓库不再对taget包进行收录,也就不会继续更新