#!/bin/sh # Configure git for corporate proxy git config --global http.proxyAuthMethod basic # Clone git-repo git init git config core.sparsecheckout true echo $SPARSE_CHECKOUT >> .git/info/sparse-checkout git remote add -f origin $REMOTE_REPO git pull origin $REMOTE_BRANCH # Create target folder and move files mkdir -p $TARGET_DIR if [ -n $FLATTEN_FOLDER ]; then # Flatten folder structure mv ./*/**/* $TARGET_DIR else # Retain folder structure mv ./* $TARGET_DIR fi exec "$@"