git提交文件大于100M,! [remote rejected] master -> master (pre-receive hook declined)

用lfs解决

lfs的源码

https://github.com/git-lfs/git-lfs

下载

git lfs install

添加到lsf中

git lfs track "文件名或者文件后缀"

生成一个文件.gitattributes

git提交文件大于100M,! [remote rejected] master -> master (pre-receive hook declined)_第1张图片

上传到github中

git add .gitattributes
git commit -m "lfs"
git push -u -f

继续提交时候会报错

git add 文件名
git commit -m "大文件"
git push -u -f

error: failed to push some refs to ‘https://github.com/lzh66666/park_opencv.git’

git提交文件大于100M,! [remote rejected] master -> master (pre-receive hook declined)_第2张图片
根据提示执行命令

git config lfs.https://github.com/lzh66666/park_opencv.git/info/lfs.locksverify false

git提交文件大于100M,! [remote rejected] master -> master (pre-receive hook declined)_第3张图片

再次提交即可

git push -u -f

git提交文件大于100M,! [remote rejected] master -> master (pre-receive hook declined)_第4张图片

成功上传到github中

你可能感兴趣的:(linux,GitHub,解决问题,git,github)