Sets the current or given git directory and submodules to be marked as safe
Necessary for some CI/CD systems which have wacky permissions triggering this error:
Necessary for some CI/CD systems like Azure DevOps Pipelines which have incorrect ownership on the git checkout dir triggering this error:
fatal: detected dubious ownership in repository at '/code/sql'
"
@ -37,17 +37,5 @@ help_usage "$@"
#min_args 1 "$@"
dir="${1:-.}"
cd"$dir"
echo"Setting directory as safe: $PWD"
git config --global --add safe.directory "$PWD"
whileread -r submodule_dir;do
dir="$PWD/$submodule_dir"
echo"Setting directory as safe: $dir"
git config --global --add safe.directory "$dir"
done < <(git submodule | awk '{print $2}')
echo"Done"
# this script is standalone without lib dependency so can be called directly from bootstrapped CI before submodules, since that is the exact problem that needs to be solved to allow CI/CD systems with incorrect ownership of the checkout directory to be able to checkout the necessary git submodules