Skip to content

bboe/dockergit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Docker and Git Unsafe Repository Issue on MacOS

I encountered the following odd issue this week and took steps to reproduce.

Environment

I am running:

  • macOS Monterey 12.4
  • Docker Desktop 4.9.0 (80466)
  • Docker Engine: 20.10.16

I've been told the bug is not reproducible on Linux, thus it likely only impacts Docker on Mac.

I have also verified that the problem does not exist if the "Enable VirtioFS accelerated directory sharing" experimental feature is enabled. However, the problem does exist regardless of the "Use the new Virtualization framework" experimental feature being enabled or not (assuming VirtioFS is not enabled).

Steps to Reproduce

git clone https://github.com/bboe/dockergit.git
cd dockergit
./run.sh

At this point you will have a shell in the container. Run git status and you might see the following:

/a $ git status
fatal: unsafe repository ('/a' is owned by someone else)
To add an exception for this directory, call:

    git config --global --add safe.directory /a

Here's where it becomes interesting. Simply run ls and then re-run git status and it should work as expected:

a/ $ ls
Dockerfile     README.md      run.sh
/a $ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages