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

Re: BUG: Git path --config doesn't work with ~ symbol

From
Jeff King <peff@peff.net>
Date
May 5, 2021, 19:01 UTC
Message-ID
<YJLrm0nqWL6TnUFb@coredump.intra.peff.net>
In-Reply-To
<CAEumJaA7NBm9Kdx7aCD1gavGguLmGcnvFcA52YvUk7g_FPzHZw@mail.gmail.com>
On Wed, May 05, 2021 at 09:59:58PM +0300, Theodor Negrescu wrote:
Show 8 quoted lines
> You're right, "notepad ~/test.txt" doesn't work either.
> I figured out a workaround:
> [alias]
>     cfg = "!git config --file $(echo ~)/git-settings/.gitconfig "
> However what confuses me is that I also have
> [core]
>     hooksPath = ~/git-settings/hooks
> and that ~ works. So why doesn't it work in config --file?

Some config options that refer to paths specifically expand "~", exactly because there is no shell involved when Git reads them.

-Peff
Previous: Theodor NegrescuNext: Jeff King
Message 8 of 9 in “BUG: Git path --config doesn't work with ~ symbol”
  1. Theodor NegrescuMay 5, 2021
  2. Theodor NegrescuMay 5, 2021
  3. Jeff KingMay 5, 2021
  4. Eric SunshineMay 5, 2021
  5. Theodor NegrescuMay 5, 2021
  6. Jeff KingMay 5, 2021
  7. Theodor NegrescuMay 5, 2021
  8. Jeff KingMay 5, 2021
  9. Jeff KingMay 5, 2021

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.