我有一个 bitbucket 项目,它也有一个集成的 LFS 模块。我已经确认 LFS 模块中预期存在的文件存在于 LFS 模块本身中,而不是在主项目中。
但是当我克隆项目时,发生的事情是这样的:
Cloning into 'testing'...
remote: Counting objects: 310, done.
remote: Compressing objects: 100% (164/164), done.
remote: Total 310 (delta 124), reused 219 (delta 104)
Receiving objects: 100% (310/310), 25.57 MiB | 846.00 KiB/s, done.
Resolving deltas: 100% (124/124), done.
Checking connectivity... done.
Downloading xxx1.file (60.16 MB)
Downloading xxx2.file (61.16 MB)
Downloading xxx3.file (62.16 MB)
Downloading xxx4.file (63.16 MB)
使用“git clone”命令时,LFS 文件也会一起下载。如果我尝试突然停止下载,那么 git 存储库中的大部分文件都会在本地删除,并在“git status”上显示:
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: .gitattributes
deleted: .gitignore
使用“git clone”命令时如何避免发生“git lfs pull”?
GIT LFS ENV:
git-lfs/2.1.0 (GitHub; linux amd64; go 1.8; git bd2c9987)
git version 1.9.1
Endpoint=REMOTE/info/lfs (auth=basic)
LocalWorkingDir=LOCAL
LocalGitDir=LOCAL/.git
LocalGitStorageDir=LOCAL/.git
LocalMediaDir=LOCAL/.git/lfs/objects
LocalReferenceDir=
TempDir=LOCAL/.git/lfs/tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
AccessDownload=basic
AccessUpload=basic
DownloadTransfers=basic
UploadTransfers=basic
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"
最佳答案
也许这就是您需要的答案(希望答案还不算太晚:)):git lfs install --skip-smudge
--skip-smudge: Skips automatic downloading of objects on clone or pull. This requires a manual "git lfs pull" every time a new commit is checked out on your repository.
关于GIT 仅 pull 项目文件而不 pull LFS 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43865276/