From acdbab2828f9b9501ac3659961358de6c559d4ee Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 8 Aug 2022 14:44:16 -0400 Subject: [PATCH] fix: mark working directory as safe for git commands Newer git versions - newer than 2.35.2 - complain due to a security patch. This patch is for multi-user systems or Windows machines. Fortunately, the issue isn't _really_ an issue for the CI use-case, so it is okay to mark the directory as safe. See https://github.blog/2022-04-12-git-security-vulnerability-announced/ for more details. Closes #25 --- bin/dokku-deploy | 1 + bin/parse-ci-commit | 1 + 2 files changed, 2 insertions(+) diff --git a/bin/dokku-deploy b/bin/dokku-deploy index db47750..7c2fd12 100755 --- a/bin/dokku-deploy +++ b/bin/dokku-deploy @@ -89,6 +89,7 @@ if [ -n "$DEPLOY_DOCKER_IMAGE" ]; then ssh "$ssh_remote" -- git:from-image "$remote_app_name" "$DEPLOY_DOCKER_IMAGE" "$DEPLOY_USER_NAME" "$DEPLOY_USER_EMAIL" else log-info "Pushing to Dokku Host" + git config --global --add safe.directory "$PWD" # shellcheck disable=SC2086 git push $GIT_PUSH_FLAGS "$GIT_REMOTE_URL" "$commit_sha:refs/heads/$BRANCH" fi diff --git a/bin/parse-ci-commit b/bin/parse-ci-commit index 8e2cfdd..d3fed75 100755 --- a/bin/parse-ci-commit +++ b/bin/parse-ci-commit @@ -29,6 +29,7 @@ elif [ -n "$TRAVIS_COMMIT" ]; then # travisci value="$TRAVIS_COMMIT" else + git config --global --add safe.directory "$PWD" value=$(git rev-parse HEAD 2>/dev/null || true) fi