error obtaining vcs status when running delve as root
Asked Answered
P

4

11

I am trying to run sudo dlv debug on Arch Linux and I keep getting following error:

error obtaining VCS status: exit status 128
    Use -buildvcs=false to disable VCS stamping.
exit status 1

When I remove the .git folder, sudo dlv debug runs as expected, so I assume it could be a configuration issue with git?!

Personnel answered 18/5, 2022 at 15:47 Comment(1)
In some cases, the best solution will be: Don't run as root.Surgeonfish
G
18

I had a similar error message when debugging code opened in a remote container via vscode.

when I used git status I got a message saying the git repository is unsafe was owned by someone else. And then a message explaining to use:

git config --global --add safe.directory [your dir here]

doing this I no longer get the VCS stamping warning

Galway answered 8/6, 2022 at 10:54 Comment(4)
I have the same issue and this answer helped me to understand what is wrong with it, so I have set proper user access to the files.Malvinamalvino
Same issue while building Terraform providers, this helpedAnimator
Make sure the dir does not have symlinks in it. This works only with absolute paths.Verdha
This solved this error for me. But my case was different. I had set the container USER to "app", but my volume mount was set to "root". So I guess Git didn't trust because the owner of the directory was different from the current login user.Omor
D
1

For those coming from Google, you probably don't have the permissions to a folder. chmod user:user folder and add -R to propagate it in subfolders.

Davisdavison answered 26/6, 2023 at 23:45 Comment(1)
This also happens when you are using a non-root user in your DockerfileEthiopia
D
1

If you bump into this error using golangci-lint, you can fix this by adding env GOFLAGS=-buildvcs=false like this:

GOFLAGS=-buildvcs=false golangci-lint run -v
Deoxygenate answered 24/4 at 13:42 Comment(0)
W
0

This problem also occurs when Go is used with a very old version of Git, such as version 1.8, which is a part of CentOS 7. Reinstalling Git version 2.36 resolves the issue.

Winzler answered 18/3 at 12:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.