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

[SOLVED] Re: Local git server can't serve https until repos owned by http, can't serve ssh unless repos owned by user after 2.45.1

From
Jamie Landeg-Jones <jamie@catflap.org>
Date
Aug 1, 2024, 00:15 UTC
Message-ID
<202408010015.4710FGtf018148@donotpassgo.dyslexicfish.net>
In-Reply-To
<0ae914c6-70be-44b8-a6b8-53f0b15d5674@gmail.com>
"David C. Rankin" <drankinatty@gmail.com> wrote:
>    I'd be happy if the docs were just updated with a concise explanation of 
> how to support both ssh and https to the same repo running under Apache -- if 
> that is doable.

Hi. I've done some investigating, and have discovered what the problem is (with my setup, at least)

It only tries to access /etc/gitconfig (or /usr/local/etc/gitconfig) - putting the rules in there allow it to work, but with the caveat mentioned by an earlier poster - you need to add a path of "." as well as the required directories. (or enable everything with a path of "*")

Now, I don't want to do that globally: "*" it's too risky, and I haven't delved deep enough to determine if "." is a security risk too.

However, there is a better solution:

The problem is, the environment variable HOME isn't defined when the http server calls cgi-http-backend.

I actually have an intermediate script that is called by httpd, that itself execs git-http-backend, so all I needed to do was add the line

export HOME=/.../git-web-user/

before the exec, and it now works as expected, picking up .gitconfig from the .../git-web-user/ directory.

If you call git-http-backend directly, you may be able to set the environment variable in the httpd config. If not, just create an intermediate script, something like

#!/bin/sh export HOME=... exec <path-to-git-http-backend>

, and change http to call that.

Now, I don't think that if not set, git should determine HOME itself (from the password file etc.), as someone may want that disabled for other reasons, HOWEVER, this should really be documented.

So, in my mind, the fix is to fix the "." directory requirement, and document the potential need to set HOME.

Ler me know if this works for you!
Cheers, Jamie
Previous: David C. RankinNext: Junio C Hamano
Message 17 of 20 in “Local git server can't serve https until repos owned by http, can't serve ssh unless repos owned by user after 2.45.1”
  1. David C. RankinJun 17, 2024
  2. Junio C HamanoJun 17, 2024
  3. Michal SuchánekJun 17, 2024
  4. Michal SuchánekJun 25, 2024
  5. Junio C HamanoJun 25, 2024
  6. Michal SuchánekJun 25, 2024
  7. Phillip WoodJun 26, 2024
  8. Junio C HamanoJun 26, 2024
  9. Phillip WoodJun 26, 2024
  10. Junio C HamanoJun 26, 2024
  11. Michal SuchánekSep 25, 2024
  12. Joey HessAug 29, 2024
  13. Jamie Landeg-JonesJul 26, 2024
  14. David C. RankinJul 26, 2024
  15. Jamie Landeg-JonesJul 28, 2024
  16. David C. RankinJul 28, 2024
  17. [SOLVED] Re: Local git server can't serve https until repos owned by http, can't serve ssh unless repos owned by user after 2.45.1Jamie Landeg-Jones, Aug 1, 2024
  18. Junio C HamanoAug 2, 2024
  19. David C. RankinJun 18, 2024
  20. Junio C HamanoJun 24, 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.