diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 10f14be6b8..11bcc16f69 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -16,6 +16,7 @@ services: volumes: # Update this to wherever you want VS Code to mount the folder of your project - ..:/workspace:cached + - ${HOME}/.gitconfig:/home/vscode/.gitconfig-host:ro # Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details. # - /var/run/docker.sock:/var/run/docker.sock diff --git a/.devcontainer/scripts/notify-dev-entrypoint.sh b/.devcontainer/scripts/notify-dev-entrypoint.sh index 7264e3b5b0..73c7ff8c80 100755 --- a/.devcontainer/scripts/notify-dev-entrypoint.sh +++ b/.devcontainer/scripts/notify-dev-entrypoint.sh @@ -7,7 +7,15 @@ set -ex # tools and the filesystem mount enabled should be located here. ################################################################### +# Include host gitconfig when mounted so aliases and user preferences are available. +if [ -f /home/vscode/.gitconfig-host ]; then + if ! git config --global --get-all include.path | grep -Fxq /home/vscode/.gitconfig-host; then + git config --global --add include.path /home/vscode/.gitconfig-host + fi +fi + # Tell git the workspace repository is safe, else upcoming commands will fail. + git config --global --add safe.directory /workspaces/notification-admin git config --global --add safe.directory /workspace