myoung34 / docker-github-actions-runner

This will run the new self-hosted github actions runners with docker-in-docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fatal: detected dubious ownership in repository

vmk-dev opened this issue · comments

Upgraded docker engine to latest version and pulled latest docker image from myoung34/github-runner:latest.

Now runner cannot successfully run any job due to the following error:

/usr/bin/git config --local --get remote.origin.url
Error: fatal: --local can only be used inside a git repository
...
...
...
Error: fatal: detected dubious ownership in repository at '/tmp/WORKDIR'
  To add an exception for this directory, call:
  
  	git config --global --add safe.directory /tmp/WORKDIR
  Error: The process '/usr/bin/git' failed with exit code 128

I have no volumes defined in the docker-compose file so permission errors only exist within the docker image.

Any ideas where this comes from?

This is a new feature of git introduced in version 2.35.2.

https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory

If you are on a distro with that version or higher, then the running user will either need to own the directory or you can configure safe.directory to a wildcard.

Have you configured the work dir to be /tmp? The entrypoint script should configure the work dir to be owned by the run user.

@nmalaguti thank you for the answer. It was a problem with the permissions of my /tmp folder. Somehow it changed the owner which caused this problems. Solved

@vmk-dev i ran into the same issue but I don't see any difference in my /tmp folder ownership, hmm

@vmk-dev nevermind! on my host VM i reviewed the folders inside of /tmp/ which was work_1 and work_2 and they were:
drwxr-xr-x 3 1001 root 38 Aug 9 23:53 EXAMPLEFOLDER/

did a recursive chown and things are working again! although i wonder if the issue will pop up when the workers makes new folders