kubernetes-client / gen

Common generator scripts for all client libraries
Apache License 2.0
148 stars 146 forks source link

Dubious Ownership error for /source/openapi-generator #236

Closed maly7 closed 1 year ago

maly7 commented 1 year ago

When running the generator inside the container, the following error is reported, and generation fails.

/source/openapi-generator /
fatal: detected dubious ownership in repository at '/source/openapi-generator'
To add an exception for this directory, call:

    git config --global --add safe.directory /source/openapi-generator

If it helps, I'm running the generator using java-crd-cmd.sh:

java-crd-cmd.sh -n com.vmware.tanzu.apps.config -p com.vmware.tanzu.acs -l 2 -h true -o /tmp/gen-output -g true

For now, I've worked around the issue by adding RUN git config --system --add safe.directory '/source/openapi-generator' in my fork. I'm happy to contribute the change, but I wasn't sure if this would be the best fix.

ityuhui commented 1 year ago

I agree with @maly7's fix

And I made a PR https://github.com/kubernetes-client/gen/pull/237 for maintainers to review this solution.