20220304记录

lfs : large file storage

安装

最新版本git-lfs 3.0.2要求libc6 高于2.32,而Ubuntu20.04默认的libc6版本是2.31,不支持安装git lfs 3.0.2
因此Ubuntu20.04版本安装git lfs 3.0.1版本,Ubuntu16.04可安装git lfs 2.13.3版本

使用

git lfs track *.so
执行之后自动生成.gitattributes,此文件记录需要lfs跟踪的文件、文件类型
git add .gitattributes
git add .
git add file.iso
git commit -m “Add disk image”
git push

Gerrit使能lfs

如果不经过gerrit,那上面是可以正常push成功,可是中间经过gerrit,那push时就会有错误提示如下:
batch response: Fatal error: LFS is not available for repository
batch response: Repository or object not found: http://…/objest/batch

因此,Gerrit需要安装lfs plugin和使能lfs功能。方法如下:
lfs插件安装:忘了,后补
ssh -p 29418 xxx@localhost gerrit plugin -h
ssh -p 29418 xxx@localhost gerrit plugin install lfs.jar

lfs插件使能
gerrit etc/gerrit.config增加:

[lfs]
    plugin = lfs

All-projects.git
git clone …29418:All-Project.git
touch lfs.config
vim lfs.config

   [lfs "^.*"]
		enabled = true
		maxObjectSize = 100m

git add .
git commit -m
git push origin HEAD:refs/meta/config

重启gerrit,在All-Projects的网页可以看到lfs enabled true
在这里插入图片描述
这时候,需要经过gerrit的lfs文件push,就可以成功了。

Harmony lfs data下载

关于从harmony使用mirror下载代码镜像,无法下载lfs data,导致在自己的gerrit上执行git lfs pull无法获取到源文件问题。我通过如下方法解决,如果有其他更好方法,欢迎讨论,感谢。
1、从gitee下载Harmony代码并执行git lfs fetch --all
2、执行git push --mirror 到自己的gerrit网站
3、执行git lfs push --all

20210315记录

下载代码出现git-lfs: not found
git-lfs smudge --skip – ‘mmplayer/librtmp/lib/jb_4.4.2/cortex-a9/librtmp.so’: 1: git-lfs smudge --skip – ‘mmplayer/librtmp/lib/jb_4.4.2/cortex-a9/librtmp.so’: git-lfs: not found
error: external filter git-lfs smudge --skip – %f failed -1
error: external filter git-lfs smudge --skip – %f failed

git --version 查看git 版本
下载安装git lfs
sudo apt-get install git-lfs
网络太差了,获取失败,手动下载

选择适合自己的版本
sudo dpkg -i git-lfs_2.13.2_amd64.deb
安装成功后git lfs可用

#20240103记录

执行 git lfs pull出现git-lfs-authenticate报错问题
Downloading LFS objects: 0% (0/1), 0 B | 0 B/s
batch request: fatal: Gerrit Code Review: git-lfs-authenticate: not found: exit status 1
batch request: fatal: Gerrit Code Review: git-lfs-authenticate: not found: exit status 1
batch request: fatal: Gerrit Code Review: git-lfs-authenticate: not found: exit status 1
error: failed to fetch some objects from ‘https://xxxxx.git/info/lfs’

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐