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

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

From
TNTheodor Negrescu <theodor.negrescu@gmail.com>
Date
May 5, 2021, 18:59 UTC
Message-ID
<CAEumJaA7NBm9Kdx7aCD1gavGguLmGcnvFcA52YvUk7g_FPzHZw@mail.gmail.com>
In-Reply-To
<YJLla4gNEMS2yxCv@coredump.intra.peff.net>
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?
On Wed, May 5, 2021 at 9:35 PM Jeff King <peff@peff.net> wrote:
Show 19 quoted lines
>
> On Wed, May 05, 2021 at 09:30:21PM +0300, Theodor Negrescu wrote:
>
> > I'm using powershell, but usually ~ works there. Typing "cd ~" would
> > work for example.
> > Also I tried using the command as an alias and it still didn't work.
>
> I don't know anything about powershell, but generally "cd" is a builtin
> to the shell (because it is impacting the shell's environment). So it
> may be that powershell "cd" expands "~" itself, but that the shell
> doesn't expand it for executed commands.
>
> There are some Windows folks who hang out on this list, so you may get a
> better response. But you might also ask in the Git for Windows mailing
> list:
>
>   https://groups.google.com/g/git-for-windows
>
> -Peff
Previous: Jeff KingNext: Jeff King
Message 7 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.