github可以算是一个很好地存放东西的地方了,可是如果上传大于100mb的文件会提示失败,而github提供了一个大文件的上传方法。那就是Large File Storage (简称LFS),根据以下步骤进行。
1 下载LFS,官网下载地址
https://github.com/git-lfs/git-lfs/releases/download/v2.9.2/git-lfs-windows-v2.9.2.exe
后续操作请务必在git bash中运行
2切换到你相应的目录
git lfs install #(使用lfs功能)
git lfs track "yourfile" #lfs track到你的文件上
git add .gitattributes #将文件lfs信息 添加
3接下来就像正常的使用你的git就行了
git add yourfile
git commit -m "upload large file"
git push origin master
请务必注意,如果使用了lfs以后,git给你报错
batch request: git@github.com: Permission denied (publickey).: exit status 255
这是一个BUG,目前还没修复,说明你使用了命令行(cmd,powershell),没有在git bash下运行命令。目前的解决方案是在git bash 命令行中运行git命令即可。
BY THE WAY,如果你上传依旧报100mb限制的错误,请清理一下仓库,严格按照上面的顺序进行,如果是从0开始 请严格按照下面描述的顺序操作。
git init
git remote add origin git@github.com:yourname/yourrepository
git pull
git lfs install
git lfs "track yourfile"
git add .gitattributes
git add yourfile
git commit -m "large file"
git push
每天学点linux