-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Compose: Add Git safe directory when needed #7923
Comments
Workaround until this issue is addressed: microsoft/vscode-remote-release#7923
Any rough idea of timeline on this? This doesn't always happen, and it's difficult to understand what triggers it, but when it happens it doesn't go away. The "fix" using |
❤️ |
Could you give Dev Containers 0.373.0-pre-release a try and let me know if that works? That fixes the Docker Compose case and also covers cases where the Git root folder is between the workspace folder and the mount point. |
@markedwards have you had a chance to test using the pre-release? Thanks! |
I haven't, and the problem is I haven't experienced this issue in quite some time. I have no idea how to reproduce it consistently. |
@chrmarti is there an alternative way to verify this bug? |
I did test with the pre-release, and I did get the error in the middle of the session. I haven't seen it again yet at the beginning of a session (ie. right after Dev Container is built). |
Hmm. @chrmarti I will reopen this bug so that you can investigate further. |
Thanks, @pamelafox! |
@pamelafox If it is only in the middle of a session I wonder what might have changed at that point. Could you check the ownership of the Git root folder when this occurs? Is this with the repository on a local folder or in a Docker volume? |
Here's a screenshot of it happening- this is inside the Dev Container from https://github.com/Azure-Samples/rag-postgres-openai-python/tree/main/.devcontainer Here's what it says for ownership of .git inside workspace:
|
Here's what it says run I check ownership from my local Terminal:
|
@pamelafox What ownership does the |
vscode ➜ /workspace $ ls -ld ../workspace/ |
That doesn't match my previous understanding of the error message. I thought that would only show when the ownership/permissions are such that someone else might have manipulated the repository, but that does not appear to be the case here. 🤔 |
I just had the git issue with a new Dev Container rebuild. vscode ➜ /workspace $ ls -ld .git vscode ➜ /workspace $ ls -ld ../workspace/ |
@pamelafox Do you know why |
I am on a Mac M1 with local Docker Desktop. I don't know why, no. I could jump on a Teams call so you could poke at my system, if that'd help. I actually just got it a few minutes ago with another repo after container rebuild, so it might be reproducible in a call. Or let me know what other logs/commands to run. |
For what it's worth, I have the same issue on Mac M1 with local Docker Desktop. |
I ran into this issue a couple times as well, with a simple devcontainer setup that is not using docker-compose.
You can find my VSCode and Docker version below:
macOS Sonoma 14.5 (23F79)
Docker Desktop 4.32.0 (157355) $ docker --version
Docker version 26.1.4-1, build 5650f9b10226d75e8e9a490a31cc3e5b846e0034 VSCode:
|
My workaround, which seems to be reliable, is:
or whatever your workspace directory is that you're having issues with.
|
Today I also encountered this issue for the first time. I am using a single container (no docker compose). So the fix mentioned by @chrmarti seems not to work in this case. Possible workarounds (from within the container):
|
@nikostro the Workarounds suggest using I just tried it on my machine* # On my host machine
# Note: there is no /app in my filesystem -
# it's the project root (directory with .git) in my dev container
git config --global --add safe.directory /app That seems like the cleanest solution, as long as you're comfortable with a non-existent directory marked as safe on your host machine. 👍 * My machine is also an M1 Mac with Docker Desktop and a docker-compose project as others have reported. |
Related and maybe fixed by it: #8656 |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
The fix for #8656 is in Dev Containers 0.385.0-pre-release. Could you give that a try and let me know if that fixes it? |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
I'm adding a fix to the single container case (Docker Compose case needs more investigation) where the repository root folder is added as a safe directory in the container if the current user in the container is not the same as the owner of the repository root folder and on the local machine the current user and the owner of the repository root folder are the same.
This is available in Dev Containers 0.274.0-pre-release. Will open a new issue to investigate adding this for Docker Compose setups too.
Originally posted by @chrmarti in #7628 (comment)
The text was updated successfully, but these errors were encountered: