Skip to content

Instantly share code, notes, and snippets.

@jldevezas
Last active April 28, 2022 16:06
Show Gist options
  • Save jldevezas/03213e9b1ead5792ae331b2b41dcd825 to your computer and use it in GitHub Desktop.
Save jldevezas/03213e9b1ead5792ae331b2b41dcd825 to your computer and use it in GitHub Desktop.
Installing LFS for a cloned Git repository when using lfs-filestore
#!/bin/bash
if [[ $# -lt 1 ]]
then
echo "Usage: $0 LFS_FOLDERSTORE_PATH"
exit 1
fi
lfs_folderstore_bin=$(which lfs-folderstore)
lfs_folderstore_path=$1
if [[ -z "$lfs_folderstore_bin" ]]
then
echo "!!! Error: could not find an executable lfs-folderstore, please install it from" \
"https://github.com/sinbad/lfs-folderstore/releases if it's missing, or add the" \
"appropriate permissions"
exit 2
fi
read -p "Continuing will run 'git reset --hard'. Confirm? [yN] " confirm
if [[ -z "$confirm" || "$confirm" != "y" && "$confirm" != "Y" ]]
then
echo "==> Aborted"
exit 3
fi
git config --add lfs.customtransfer.lfs-folder.path lfs-folderstore
git config --add lfs.customtransfer.lfs-folder.args "$lfs_folderstore_path"
git config --add lfs.standalonetransferagent lfs-folder
git reset --hard
echo "==> Successful"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment