git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] setup: support GIT_IGNORE_INSECURE_OWNER environment variable

From
Jeff King <peff@peff.net>
Date
Jun 26, 2024, 20:37 UTC
Message-ID
<20240626203705.GB441931@coredump.intra.peff.net>
In-Reply-To
<a87a7131-3207-42f2-93c0-e6e9e02a2062@geekplace.eu>
On Wed, Jun 26, 2024 at 09:06:10PM +0200, Florian Schmaus wrote:
Show 38 quoted lines
> > True.  As long as it is deemed safe to honor the one-off "git -c
> > safe.directory=..." from the command line, for the purpose of this
> > "I who am running this 'git' process hereby declare that I trust
> > this and that repository", I think it would be the best solution
> > for the "git daemon" use case.
> 
> How does one pass "-c safe.directory=…" to git-http-backend?
> 
> I currently have an Apache config snippet like
> 
> SetEnv GIT_PROJECT_ROOT /var/www/example.org/htdocs/git
> SetEnv GIT_HTTP_EXPORT_ALL
> ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
> 
> <Files "git-http-backend">
>   Require all granted
>   AcceptPathInfo On
> </Files>
> 
> to serve git repositories.
> 
> Granted, the apache user has a home directory, so I am probably able to set
> save.directory via ~/.gitconfig.
> 
> However, the point here is that git is often invoked indirectly, with no
> control over the command line arguments that are passed to it. On the other
> hand, one has usually control over the environment variables.
> 
> I agree that "-c safe.directory=…" is preferable to
> GIT_IGNORE_INSECURE_OWNER. However, sometimes using "-c safe.directory=…" is
> cumbersome and maybe even impossible.
> 
> One alternative to GIT_IGNORE_INSECURE_OWNER would be a generic
> GIT_EXTRA_ARGS environment variable. So one could set
> 
> GIT_EXTRA_ARGS="-c safe.directory=…"
> 
> Not saying that I like the idea, just pointing out this option.
You can do:
  GIT_CONFIG_COUNT=1
  GIT_CONFIG_KEY_0=safe.directory
  GIT_CONFIG_VALUE_0="*"
It is a bit verbose, but it's a documented interface in git-config(1).

Under the hood "git -c" uses a different, older mechanism, but we've not documented it nor promised that it will remain stable.

-Peff
Previous: Florian SchmausNext: Phillip Wood
Message 9 of 20 in “support GIT_IGNORE_INSECURE_OWNER environment variable”
  1. 0/1 support GIT_IGNORE_INSECURE_OWNER environment variableFlorian Schmaus, Jun 26, 2024
  2. setup: support GIT_IGNORE_INSECURE_OWNER environment variableFlorian Schmaus, Jun 26, 2024
  3. Phillip WoodJun 26, 2024
  4. rsbecker@nexbridge.comJun 26, 2024
  5. phillip.wood123@gmail.comJun 26, 2024
  6. Phillip WoodJun 26, 2024
  7. Junio C HamanoJun 26, 2024
  8. Florian SchmausJun 26, 2024
  9. Jeff KingJun 26, 2024
  10. Phillip WoodJun 27, 2024
  11. Junio C HamanoJun 27, 2024
  12. Phillip WoodJun 28, 2024
  13. Junio C HamanoJun 28, 2024
  14. Phillip WoodJul 1, 2024
  15. Junio C HamanoJul 1, 2024
  16. Johannes SchindelinJul 1, 2024
  17. Jeff KingJul 1, 2024
  18. Junio C HamanoJul 1, 2024
  19. Jeff KingJul 1, 2024
  20. Eric WongJul 2, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.