git使用push指令时报错单个文件大小超出100M,选择忽略一些不必要的文件
GIT上传源码(忽略不必要文件)到github仓库
博主第一次上传maven项目到github时候就碰到了文件过大而导致命令行反馈
error: this exceeds GitHub's file size limit of 100.00 MB
然后根据报错的路径去找文件,发现就是普通的资源文件而已,没必要上传到远程仓库,例如 target 目录
浏览了网上一些前辈的分享,也可以找到途径把超过100M的资源传上去,如有需要可以自行查找。
以target文件夹为例,首先进入到需要上传的项目文件夹,然后右键 Git Bash Here
点击后初始化命令行,输入 vim .gitignore
然后回车键,进入vim编辑文本框,按字母 i 进入编辑状态,输入target/
如果不止是target目录,类似的还要忽略.idea,.iml类型的文件
可以再加上其他的,如
然后按 Esc(退出编辑模式)再输入 :wq (保存退出)就好了
引用本文中的 .gitignore 可以去 这里
## .gitignore for Grails 1.2 and 1.3
# .gitignore for maven
target/
*.releaseBackup
# web application files
#/web-app/WEB-INF
# IDE support files
/.classpath
/.launch
/.project
/.settings
/*.launch
/*.tmproj
/ivy*
/eclipse
# default HSQL database files for production mode
/prodDb.*
# general HSQL database files
*Db.properties
*Db.script
# logs
/stacktrace.log
/test/reports
/logs
*.log
*.log.*
# project release file
/*.war
# plugin release file
/*.zip
/*.zip.sha1
# older plugin install locations
/plugins
/web-app/plugins
/web-app/WEB-INF/classes
# "temporary" build files
target/
out/
build/
# other
*.iws
#.gitignore for java
*.class
# Package Files #
*.jar
*.war
*.ear
## .gitignore for eclipse
*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
## .gitignore for intellij
*.iml
*.ipr
*.iws
.idea/
## .gitignore for linux
.*
!.gitignore
!.gitattributes
!.editorconfig
!.eslintrc
!.travis.yml
*~
## .gitignore for windows
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
## .gitignore for mac os x
.DS_Store
.AppleDouble
.LSOverride
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
## hack for graddle wrapper
!wrapper/*.jar
!**/wrapper/*.jar
此处结题。