Skip to content
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

Repository path '/repo/' is not owned by current user #34

Closed
asbjornu opened this issue Dec 22, 2023 · 3 comments
Closed

Repository path '/repo/' is not owned by current user #34

asbjornu opened this issue Dec 22, 2023 · 3 comments

Comments

@asbjornu
Copy link
Member

asbjornu commented Dec 22, 2023

docker run --rm -u $(id -u):$(id -g) -v "$(pwd):/repo" gittools/gitversion:6.0.0-beta.3-fedora.36-6.0-arm64 /repo fails with:

Unhandled exception. LibGit2Sharp.LibGit2SharpException: repository path '/repo/' is not owned by current user
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 154
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 172
   at LibGit2Sharp.Core.Proxy.git_repository_open(String path) in /_/LibGit2Sharp/Core/Proxy.cs:line 2560
   at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter) in /_/LibGit2Sharp/Repository.cs:line 159
   at LibGit2Sharp.Repository..ctor(String path) in /_/LibGit2Sharp/Repository.cs:line 70
   at GitVersion.GitRepositoryInfo.GetProjectRootDirectory() in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepositoryInfo.cs:line 88
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at GitVersion.GitRepositoryInfo.get_ProjectRootDirectory() in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepositoryInfo.cs:line 31
   at GitVersion.GitRepositoryInfo.GetGitRootPath() in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepositoryInfo.cs:line 96
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at GitVersion.GitRepositoryInfo.get_GitRootPath() in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepositoryInfo.cs:line 30
   at GitVersion.GitVersionLibGit2SharpModule.<>c.<RegisterTypes>b__0_0(IServiceProvider sp) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\GitVersionLibGit2SharpModule.cs:line 15

We should perhaps write a test that executes all of the Docker images we produce to see that they work.

@asbjornu
Copy link
Member Author

asbjornu commented Dec 27, 2023

It seems like we need to execute the following inside the Docker image, somehow:

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

@arturcic
Copy link
Member

arturcic commented Dec 27, 2023

I think it's better to have

git config --global --add safe.directory *

instead, as path to the repo that is mounted could be different

@arturcic
Copy link
Member

added in the DockerFile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants