Skip to content

Commit

Permalink
Devcontainer: move git setup to postStartCommand
Browse files Browse the repository at this point in the history
* 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
* devcontainers/cli#98
* microsoft/vscode-remote-release#4855 (comment)
  • Loading branch information
R0Wi authored and susnux committed Oct 11, 2023
1 parent a149d4e commit f74a12c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"dockerComposeFile": "docker-compose.yml",
"service": "nextclouddev",
"postCreateCommand": ".devcontainer/setup.sh",
"postStartCommand": ".devcontainer/postStart.sh",
"forwardPorts": [
80,
8080,
Expand Down
5 changes: 5 additions & 0 deletions .devcontainer/postStart.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f74a12c

Please sign in to comment.