docker-hugo
docker-hugo copied to clipboard
"'/src' is owned by someone else" reported when building status.jenkins.io with docker-hugo
We are happy users of the docker-hugo
container image to build the https://status.jenkins.io showing the condition of Jenkins infrastructure. We manage that site at https://github.com/jenkins-infra/status and are currently using docker-hugo 0.95.0.
We'd like to upgrade from 0.95.0 to 0.111.3 but our upgrade attempts fail due to an error message from command line git inside the container image. The error message reported by the GitHub action and in local development is:
mwaite@debian11-a:~/hub/infra/status$ docker compose up --build --force-recreate
[+] Building 0.0s (0/0)
[+] Running 1/0
✔ Container status-status-1 Recreated 0.1s
Attaching to status-status-1
status-status-1 | Start building sites …
status-status-1 | hugo v0.101.0-466fa43c16709b4483689930a4f9ac8add5c9f66+extended linux/amd64 BuildDate=2022-06-16T07:09:16Z VendorInfo=hugoguru
status-status-1 | ERROR 2023/07/03 23:12:15 Failed to read Git log: fatal: unsafe repository ('/src' is owned by someone else)
status-status-1 | To add an exception for this directory, call:
status-status-1 |
status-status-1 | git config --global --add safe.directory /src
status-status-1 | Error: Error building site: logged 1 error(s)
status-status-1 | Built in 1165 ms
status-status-1 exited with code 255
Can you suggest changes that we should make in order to allow our site build process to upgrade?
The failing pull request is:
- https://github.com/jenkins-infra/status/pull/305
I assume we could create our own container derived from your container with the addition of a RUN git config --global --add safe.directory /src
, but I wonder if there is a better way or an easier way.