Replies: 2 comments
-
A drive by comment. Could you say which terminal/shell you are using? It maybe that the quoting requirements vary between shells/terminals, and those quoting methods you are expecting. The quoting problem keeps coming up in a number of threads, so I thought it worth getting those details, along with asking that you also complete as much of the issue template as possible as they do provide extra insight into your setup. If you can do an MVCE as well, then that would be useful. |
Beta Was this translation helpful? Give feedback.
-
Um, I'm not to sure. Because, I feel like this occurs in multiple places/programs. I did mentioned in the OP that this is on Windows11. I use the normal Finally, I also run git commands (like commit and push) from inside Visual Studio .. so i'm not sure if that uses a shell also?
Ah, I didn't create an issue because I wasn't sure if this problem I'm having is legit and other people agree. So I haven't looked at what the issue template is. I'll check it out now: Setup
64bit
Edition Windows 11 Pro
I can't remember. Usually defaults.
Details
Not too sure. I run commands in the
I'm not sure -exactly- which command is causing this. I'm guessing it's the
The "inherited"
History is showing a mix of
Nope. Any of my private work ones. Final thoughts: I also do |
Beta Was this translation helpful? Give feedback.
-
👋🏻 G'Day all,
Problem
I have different username/email settings for WORK or PERSONAL projects.
I usually put all personal git repo's under a single folder called
Personal
.The same goes for work projects, under a
Work
folder.I'm finding the current way to configure your git user settings isn't easy and more importantly, doesn't seem to be 100% accurate all the time (aka. buggy?)
I'm hoping this could be a discussion to:
Currently, I've documented how I do this on Windows.
TL;DR: is that the global user settings need to include an ugly (well, ugly to me)
includeIf
hack. And what makes it ever worse, is that the syntax for the hack I feel is also a bit tough (yeah, I agree that's just an opinion and not factual) and DEFINATELY easy to be error prone, like my first initial attempts...Here's a quick summary of what I need to do:
.gitconfig
in myHome
directory (so on my Windows11 machine:C:\Users\purek
)☝🏻 Urgh at the lack of spaces required in the syntax -and- the linux specific path syntax, even when on windows.
C:\Projects\Work\.gitconfig
C:\Projects\Personal\.gitconfig
(or we could omit the custom personal section, which just falls back to the default settings in the home directory).
Suggestion
Ditch the
includeIf
in the "home".gitconfig
. If there's a.gitConfig
in any folder, any repo's under that "inherit" those settings.This is exactly what NuGet does with their
nuget.config
settings. If you put anuget.config
file inC:\Projects\Work
then any child/sub folders here, will also inherit those settings. These same child/sub folder do NOT need their ownnuget.config
file -> it's 🪄 magically inherited! But, if any of these child/sub folders do have their ownnuget.config
files, then they will take preferences over what was inherited and merge any settings, with the lowest hierarchy taking preference.Office NuGet doc reference:
This is really simple and easy. Win .. Win!
Current way is Buggy?
I think the current logic is causing some unintentional bug? When I look at my git history for whatever repo in my
C:\Projects\Work
folder, I sometimes see the correct settings (i.e. my Work name and email). But then i also see a scattering of other commits which have the correct email but the incorrect name! It's like it's my default system wide name. I also very rarely do commits via the GitHub UI .. so I'm very confident it's not via that. Also, this is all on one machine and no one else is committing with my name/credentials/etc. Hell no!Is there anyone else using git, like this? Are you finding this is not working (that easily/nicely) for you, too?
Final note: I'm not sure where the best place to have this discussion, so I hope this is ok/the right spot.
Beta Was this translation helpful? Give feedback.
All reactions