From 9dd158b70de7d6c962d58d06268125932cab5075 Mon Sep 17 00:00:00 2001 From: Robin Windey Date: Sun, 27 Aug 2023 15:33:01 +0000 Subject: [PATCH] Devcontainer: move git setup to postStartCommand * postCreateCommand is executed too early * If git config commands run in postCreate, a global .gitconfig will be created * Copy of local .gitconfig will be skipped if .gitconfig already exists in container * Move to later stage * https://github.com/devcontainers/cli/issues/98 * https://github.com/microsoft/vscode-remote-release/issues/4855#issuecomment-831920085 Signed-off-by: GitHub --- .devcontainer/devcontainer.json | 1 + .devcontainer/postStart.sh | 5 +++++ .devcontainer/setup.sh | 4 ---- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100755 .devcontainer/postStart.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3fb1bf42e4406..612b99fdcddfe 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,6 +3,7 @@ "dockerComposeFile": "docker-compose.yml", "service": "nextclouddev", "postCreateCommand": ".devcontainer/setup.sh", + "postStartCommand": ".devcontainer/postStart.sh", "forwardPorts": [ 80, 8080, diff --git a/.devcontainer/postStart.sh b/.devcontainer/postStart.sh new file mode 100755 index 0000000000000..20657a15a94e8 --- /dev/null +++ b/.devcontainer/postStart.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Set git safe.directory +git config --global --add safe.directory /var/www/html +git config --global --add safe.directory /var/www/html/3rdparty \ No newline at end of file diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 3485d4f7257c6..11bee7175b7cf 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -3,10 +3,6 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" >/dev/null 2>&1 && pwd )" cd $DIR/ -# Set git safe.directory -git config --global --add safe.directory /var/www/html -git config --global --add safe.directory /var/www/html/3rdparty - git submodule update --init # Codespace config