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

Re: Support of NETRC environment variable

From
Jeff King <peff@peff.net>
Date
Dec 2, 2024, 21:11 UTC
Message-ID
<20241202211156.GG776185@coredump.intra.peff.net>
In-Reply-To
<CAGinwDzTDexiXpwR0BGTTgX_9BcQ9N2RSea2UBTnyurCM0QRfg@mail.gmail.com>
On Mon, Dec 02, 2024 at 06:36:34PM +0100, Rémi Debette wrote:
Show 12 quoted lines
> This email follows discussions on this issue in the uv project:
> https://github.com/astral-sh/uv/issues/9576
> 
> The uv project supports setting an environment variable called NETRC
> that allows setting a path to a .netrc file if this one is not in the
> expected home path ~/.netrc
> Their documentation describes it here:
> https://docs.astral.sh/uv/configuration/environment/#netrc
> 
> git supports authenticating through the .netrc home file, but it seems
> it does not recognize this NETRC environment variable.
> Would there be an alternative way to set an alternate path?

No, there isn't. Git does not really support netrc itself[1]. But we do rely on libcurl for making http requests, and it handles it internally. The only explicit thing Git does is turn on the libcurl option that allows the use of netrc.

It looks like curl also has a CURLOPT_NETRC_FILE option. So I think there _could_ be a Git patch that takes the value from $NETRC and passes it there. But if this is a standard-ish interface, I wonder if it would make more sense to lobby curl folks to support $NETRC automatically.

-Peff
[1] There's also a netrc credential helper in contrib/, but that may
    defeat the purpose if you're looking for something people can just
    use out of the box. They'd need to build and install the helper, and
    then configure it.
Previous: Rémi Debette
Message 2 of 2 in “Support of NETRC environment variable”
  1. Rémi DebetteDec 2, 2024
  2. Jeff KingDec 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.