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

[FEATURE] Unsafe git directories #3

Open
danielvandenberg95 opened this issue Nov 3, 2024 · 1 comment
Open

[FEATURE] Unsafe git directories #3

danielvandenberg95 opened this issue Nov 3, 2024 · 1 comment
Labels
question Further information is requested

Comments

@danielvandenberg95
Copy link

As my git directory is located on a different server with different users, I got an "unsafe git directory" warning. I currently work around this using the following in my .yml (docker swarm):

command: sh -c "git config --global --add safe.directory /var/lib/git/repositories/myrepo.git && \
  sed -i 's/index gitweb.cgi;/rewrite ^ \\/gitweb.cgi?$query_string break;/' /etc/nginx/conf.d/nginx.conf && \
  nginx -g 'daemon off;'"

This script does two things:

  1. It allows any URL to be redirected to gitweb. That's just a nice to have on my side. Just personal.
  2. Adds myrepo.git to the safe.directory list.

According to https://stackoverflow.com/questions/71849415/i-cannot-add-the-parent-directory-to-safe-directory-in-git you can also add '*' to safe directories.

Perhaps there should be either:

  1. Documentation on how to
    A. Fix this issue, or,
    B. use this workaround
  2. Just a global git config to disable the safe directory check, or
  3. an environment option to add safe directores?
@mlan
Copy link
Owner

mlan commented Nov 6, 2024

@danielvandenberg95 many thanks for your report.

When you say that "my git directory is located on a different server with different users" it sounds like you are not mounting a volume with the git directory in the gitweb container. Perhaps you can explain more about your setup and under which use cases of gitweb that you receive the "unsafe git directory" warning?

@mlan mlan added the question Further information is requested label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants