-
|
I use both MacOS and Linux. On MacOS I use I cannot use two different .gitconfigs and prefer not to use environment variables. I would prefer a way to do this all in one file. I tried to use shell commands to change the binary, but when run exclusively via the shell Is Here are my configs for reference [credential "https://github.com"]
helper =
helper = !/bin/sh -c 'test "$(uname -s)" = "Darwin" && /opt/homebrew/bin/gh auth git-credential || /usr/bin/gh auth git-credential'Macbook ~/github> /opt/homebrew/bin/gh auth git-credential
accepts 1 arg(s), received 0
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
|
Hey @C-Loftus, thanks for the question. I've got a couple of questions:
What are you referring to as default, in this case?
As far as I can tell, we always require a single argument for What, exactly, are you expecting to happen? It'd be useful to have some more direct context around how you're trying to use this, like output when the behavior is as expected and how you're invoking that behavior. |
Beta Was this translation helpful? Give feedback.
-
|
Hi, I got the same scenario - working on both MacOS & Linux and want to hold a single [user]
name = galah92
email = my@email.com
[credential "https://github.com"]
# helper = !/opt/homebrew/bin/gh auth git-credential
helper = !gh auth git-credential
[credential "https://gist.github.com"]
# helper = !/opt/homebrew/bin/gh auth git-credential
helper = !gh auth git-credentialWhy does Thanks. |
Beta Was this translation helpful? Give feedback.
-
|
Check out git conditionals. |
Beta Was this translation helpful? Give feedback.
As far as I can tell, you're right that
gh auth setup-gitdoesn't require an argument, however,gh auth git-credentialdoes.Regardless, I wouldn't expect
$ gh auth git-credentialto succeed on its own in the shell or otherwise.What I think is happening under the hood is that whenever
gitneeds to access credentials while running withingh, it'll use this helper, effectively substituting its owngit credentialcalls withgh auth git-credential. Whatever is appended to that call gets passed throughgh auth git-credentialas the argument.Thus, I think your approach of adding that bash string to the helper should work as expected, as it will call the proper location of
gh auth git-credential…