It took me quite some time to realise that the build agents don’t support git-lfs out of the box. I ended up writing this script to run in the dependency install step:
#!/usr/bin/env bash
set -euo pipefail
pushd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null
# Build agents on appflow do not have git lfs installed.
# This script installs it on Mac and Linux
unamestr=`uname`
if ! type "git-lfs" &> /dev/null; then
echo "git-lfs not installed. Attempting installation."
if [[ "$unamestr" == 'Darwin' ]]; then
echo "Mac detected. Installing git-lfs"
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
brew install git-lfs
else
echo "Attempting git-lfs install from packagecloud.io. If you aren't on Linux, this won't work."
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install git-lfs
fi
fi
git lfs install
git lfs pull
popd
I’m checking in to see if anyone else has run into this issue, and how they solved it. Installing LFS adds time to the build process, so it would be much better if this was supported natively.