自建GitLab 13.9通过HTTPS克隆时出现Git LFS Smudge错误
GitLab 13.9 HTTPS克隆LFS文件失败问题排查与解决
问题场景
自建GitLab 13.9服务器中,部分项目通过SSH克隆无异常,但HTTPS克隆时触发LFS相关错误,具体报错如下:
Error downloading object: <file> (353bfa2): Smudge error: Error downloading <file> (353bfa2b22928633c05343fb42365cf1d1fe55582392f5d8099be6eca9986c52): batch response: Repository or object not found: https://<user:token>@<url>/info/lfs/objects/batch Use `git lfs logs last` to view the log. error: external filter 'git-lfs filter-process' failed fatal: <file>: smudge filter lfs failed
本地LFS环境信息:
git-lfs/2.13.3 (GitHub; linux amd64; go 1.16.2) git version 2.37.1 Endpoint=https://<user:token>@<url>.git/info/lfs (auth=none) LocalWorkingDir=<path> LocalGitDir=<path>/.git LocalGitStorageDir=<path>/.git LocalMediaDir=<path>/.git/lfs/objects LocalReferenceDirs= TempDir=<path>/.git/lfs/tmp ConcurrentTransfers=8 TusTransfers=false BasicTransfersOnly=false SkipDownloadErrors=false FetchRecentAlways=false FetchRecentRefsDays=7 FetchRecentCommitsDays=0 FetchRecentRefsIncludeRemotes=true PruneOffsetDays=3 PruneVerifyRemoteAlways=false PruneRemoteName=origin LfsStorageDir=<path>/.git/lfs AccessDownload=none AccessUpload=none DownloadTransfers=basic,lfs-standalone-file UploadTransfers=basic,lfs-standalone-file GIT_EXEC_PATH=/usr/lib/git-core git config filter.lfs.process = "git-lfs filter-process" git config filter.lfs.smudge = "git-lfs smudge -- %f" git config filter.lfs.clean = "git-lfs clean -- %f"
注:同一服务器上其他项目通过SSH和HTTPS克隆均正常,且无GitLab服务器配置权限。
排查与解决步骤
- 检查HTTPS凭证权限:确认使用的token对目标项目拥有LFS读取权限。部分项目可能单独配置了权限策略,即使同账号下其他项目正常,该项目可能限制了token的访问范围。建议使用项目专用部署token,确保其包含
read_repository权限。 - 修正LFS端点URL:从环境信息看,当前LFS Endpoint包含末尾的
.git,部分GitLab实例的LFS端点无需该后缀。手动修改本地仓库配置:
修改后执行git config lfs.url "https://<user:token>@<url>/info/lfs"git lfs pull或重新克隆项目。 - 重置本地LFS缓存与配置:
该操作会重置本地LFS过滤器配置并重新拉取LFS对象。git lfs uninstall git lfs install git rm --cached -r . git reset --hard git lfs pull - 验证LFS端点可达性:直接在浏览器访问
https://<user:token>@<url>/info/lfs/objects/batch(替换占位符),若返回404则说明路径错误,若返回权限错误则需调整凭证权限。 - 测试Git LFS版本兼容性:GitLab 13.9推荐使用Git LFS 2.10.0及以上版本,当前2.13.3理论兼容,但可尝试降级至2.10.x版本测试,排除版本适配问题。
内容的提问来源于stack exchange,提问作者mython paster
相关产品推荐
相关产品推荐

