Skip to content

Commit 25b4ff1

Browse files
committed
feat(git): use host git user configuration in ddev web container
1 parent ed9a70b commit 25b4ff1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

booster/.ddev/config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ timezone: Europe/Berlin
2121
hooks:
2222
pre-start:
2323
- exec-host: python3 .ddev/php/create-xdebug-local.py
24+
# Add hosts git user name and email to ddev web container git config
25+
# we will write into homeadditionas to avoid issues when user.name or user.email are not set
26+
# path .ddev/homeadditions/.gitconfig will be created with proper permissions
27+
28+
- exec-host: |
29+
GIT_USER_NAME=$(git config --get user.name || echo "")
30+
GIT_USER_EMAIL=$(git config --get user.email || echo "")
31+
if [ -n "$GIT_USER_NAME" ] && [ -n "$GIT_USER_EMAIL" ]; then
32+
mkdir -p .ddev/homeadditions
33+
{
34+
echo "[user]"
35+
echo " name = $GIT_USER_NAME"
36+
echo " email = $GIT_USER_EMAIL"
37+
} > .ddev/homeadditions/.gitconfig
38+
fi
2439
post-start:
2540
- exec: yes | pnpm install
2641
- exec: composer install --prefer-dist --no-progress --no-interaction

booster/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ psalm_sonar.json
1010
.qodo
1111
.vscode/tasks.json
1212
.vscode/launch.json
13+
.ddev/homeadditions/.gitconfig

0 commit comments

Comments
 (0)