diff --git a/lib/functions/general/git.sh b/lib/functions/general/git.sh index fbf67028cf..5ebaea0c09 100644 --- a/lib/functions/general/git.sh +++ b/lib/functions/general/git.sh @@ -56,9 +56,7 @@ function git_ensure_safe_directory() { if [[ -n "$(command -v git)" ]]; then local git_dir="$1" display_alert "git: Marking all directories as safe, which should include" "$git_dir" "debug" - if ! grep -q "directory = \*" "${HOME}/.gitconfig" 2> /dev/null; then - git config --global --add safe.directory "*" - fi + regular_git -C "$1" config --local --get safe.directory "$1" > /dev/null || regular_git -C "$1" config --local --add safe.directory "$1" else display_alert "git not installed" "a true wonder how you got this far without git - it will be installed for you" "warn" fi