[PR #5969] [MERGED] Git 2.35+ may refuse to operate on bind-mounted repos with differing ownership ("dubious ownership"), Mark /app as safe within the container. #6609

Closed
opened 2026-02-05 10:36:41 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/5969
Author: @shaoliang123456
Created: 12/30/2025
Status: Merged
Merged: 1/3/2026
Merged by: @ssddanbrown

Base: developmentHead: fix/git-safe-directory-in-docker


📝 Commits (2)

  • 5c4fc3d fix: Docker: Add
  • 018de5d fix: Configure safe directory for git in dockerfile

📊 Changes

1 file changed (+3 additions, -0 deletions)

View changed files

📝 dev/docker/Dockerfile (+3 -0)

📄 Description

Local Environment:

WSL2 + Windows 11 + Docker Desktop + Git 2.43.0

After starting the application with docker compose up, the logs show the following warning:

The repository at "/app" does not have the correct ownership and git refuses to use it:
fatal: detected dubious ownership in repository at '/app'
To add an exception for this directory, call:
git config --global --add safe.directory /app
This occurs because Git 2.35.2+ enforces ownership checks on repositories, and the bind-mounted /app directory in the container has a different UID than the container’s runtime user. While this doesn’t break the web application itself, it prevents developers from using Git commands inside the container (e.g., for debugging or version detection), and clutters the logs.

This PR automatically adds /app to Git’s safe.directory list in the app container’s entrypoint, resolving the issue without affecting functionality.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/5969 **Author:** [@shaoliang123456](https://github.com/shaoliang123456) **Created:** 12/30/2025 **Status:** ✅ Merged **Merged:** 1/3/2026 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `development` ← **Head:** `fix/git-safe-directory-in-docker` --- ### 📝 Commits (2) - [`5c4fc3d`](https://github.com/BookStackApp/BookStack/commit/5c4fc3dc2c7241cc4d32cb9ea1bf4b8d890dce06) fix: Docker: Add - [`018de5d`](https://github.com/BookStackApp/BookStack/commit/018de5def3342f1f1bd62354ffa239ade2d937cd) fix: Configure safe directory for git in dockerfile ### 📊 Changes **1 file changed** (+3 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `dev/docker/Dockerfile` (+3 -0) </details> ### 📄 Description Local Environment: WSL2 + Windows 11 + Docker Desktop + Git 2.43.0 After starting the application with docker compose up, the logs show the following warning: The repository at "/app" does not have the correct ownership and git refuses to use it: fatal: detected dubious ownership in repository at '/app' To add an exception for this directory, call: git config --global --add safe.directory /app This occurs because Git 2.35.2+ enforces ownership checks on repositories, and the bind-mounted /app directory in the container has a different UID than the container’s runtime user. While this doesn’t break the web application itself, it prevents developers from using Git commands inside the container (e.g., for debugging or version detection), and clutters the logs. This PR automatically adds /app to Git’s safe.directory list in the app container’s entrypoint, resolving the issue without affecting functionality. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:36:41 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6609