Skip to content

Commit f2cd8b3

Browse files
fix(run): Share Git config dir only if it exists
Avoid it being created when not exists
1 parent 8f1e198 commit f2cd8b3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/docker.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ run() {
5151
composer_home="-v $composer_home:$composer_home"
5252
fi
5353

54+
local gitconfig=""
55+
if [ -f ~/.gitconfig ]; then
56+
gitconfig="-v ~/.gitconfig:/root/.gitconfig:ro"
57+
fi
58+
5459
if [ -n "$GIT_EXEC_PATH" ]; then
5560
# In a Git hook environment, we need to disable TTY allocation
5661
PHPCTL_TTY="--label=no-tty"
@@ -68,7 +73,7 @@ run() {
6873
--user "$PHPCTL_USER" \
6974
$(env | awk -F= '/^[[:alpha:]]/{print $1}' | sed 's/^/-e/') \
7075
-v /var/run/docker.sock:/var/run/docker.sock \
71-
-v ~/.gitconfig:/root/.gitconfig:ro \
76+
$gitconfig \
7277
-v "$(pwd)":/usr/local/src -w /usr/local/src \
7378
-v "$PHPCTL_DIR/php.ini:/etc/php$PHP_VERSION/conf.d/zphp.ini" \
7479
$phpctl_ini \

0 commit comments

Comments
 (0)