I have pushed a FastAPI program that have large file. The repository is successfully pushed, but when the program was running, there is an error about git-lfs.
Hello @Jabalnur and welcome to the Community!
Based on the logs you have shared, it seems like you are using Bitbucket Pipelines to build/run your code.
When a Pipeline starts, it will automatically clone the repository to a folder inside the build container, but by default, this clone does not include LFS files.
It seems like the program you are executing in pipelines also needs the files that are stored in the LFS portion of your repository. To instruct pipelines to also clone the LFS during its startup you can include the lfs: true attribute in the bitbucket-pipelines.yml file.
You have the option to specify this at the global level (applies to every step) or at the step level (applies only to the step where the attribute was included) :
clone:
lfs: true
pipelines:
default:
- step:
name: Clone and download
script:
- echo "Clone and download my LFS files!"
pipelines:
default:
- step:
name: Clone with lfs on
clone:
lfs: true
script:
- ls -lh large-file.zip # 26M large-file.zip
- step:
name: Clone with lfs off
clone:
lfs: false
script:
- apt-get update && apt-get install -y git-lfs
# Download only desired files
- git lfs pull --include=large-file.zip
- ls -lh large-file.zip # 26M large-file.zip
You can find more details on the usage of LFS attribute in the Pipelines | Git Clone Behaviour | LFS documentation
Let me know in case you have any questions.
Thank you, @Jabalnur !
Patrik S
Here is my code, could you check it base on your suggestion before. Please let me know if there is anything wrong or another thing I can add.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
my deployment to production is still loading until now, Do you have any solution to this problem? and how to call the API which I use FastAPI? This is my API code:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.