nb icon indicating copy to clipboard operation
nb copied to clipboard

Conditional Git config is not used

Open Weltraumschaf opened this issue 3 years ago • 3 comments

I have a conditional config for my git identities in my dotfiles:

[includeIf "gitdir:~/nb/"]
  path = ~/.gitconfig_private

When I start nb it asks me for a name and email and adds them as global Git options:

[user]
	name = Sven
	email = [email protected]

Since I assume that the git repository nb operates is in ~/nb/ on macOS I expect that nb uses the identity option set by the includeIf in my Git config.

Weltraumschaf avatar Sep 23 '22 11:09 Weltraumschaf

Thanks for the info. I’ll have to investigate this more. I’m still trying to get includeIf to work consistently in tests. The default directory for nb is ~/.nb (with a leading .).

xwmx avatar Sep 24 '22 06:09 xwmx

The default directory for nb is ~/.nb (with a leading .)

Sorry, that's a typo. I did the test with right path and introduced the typo for the write up here. I double checked now: Also with the right path ~/.nb it does not work.

Weltraumschaf avatar Sep 28 '22 08:09 Weltraumschaf

I have the same issue but with a slightly different config, where I have a ~/.gitconfig with the following:

[includeIf "hasconfig:remote.*.url:[email protected]:*/**"]
        path = ~/.gitconfig-codeberg

This works fine for any of my other repositories that match the remote but nb seems to ignore this config. If I go to ~/.nb/home/ and then run git config -l | grep user, it shows the correct user settings.

It would be good to see this work, as I'm working with repositories across github/sourcehut/codeberg and nb forces me to have a global [user] config every time it syncs.

felixdv avatar Apr 15 '23 14:04 felixdv