You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: git/git_remotes_set_https_creds_helpers.sh
+14-8
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,8 @@ When combined with the adjacent scripts
40
40
41
41
this allows you to quickly switch many git repo checkouts from SSH to HTTPS and have them all inherit the environment auth tokens
42
42
43
+
If the GIT_GLOBAL_CONFIG environment variable is set to any value, then sets it at the global user config level instead of in the local repo
44
+
43
45
If no provider is found, checks for the following environment variables and sets them automatically in the local git repo if they're both found
44
46
45
47
GitHub:
@@ -73,16 +75,20 @@ max_args 1 "$@"
73
75
74
76
provider="${1:-all}"
75
77
78
+
#global="${2:+--global}"
79
+
global="${GIT_GLOBAL_CONFIG:+--global}"
80
+
76
81
github_cred_helper(){
77
82
# not needed to authenticate in practice
78
83
#if [ -n "${GITHUB_USER:-}" ]; then
79
84
# GH_TOKEN is higher precedence in GitHub CLI so do the same here for consistency to avoid non-intuitive auth problems where one works and the other doesn't using different tokens
80
85
if [ -n"${GH_TOKEN:-${GITHUB_TOKEN:-}}" ];then
81
86
timestamp "Setting credential helper for GitHub"
82
87
# env vars need to be evaluated dynamically not here
83
-
# shellcheck disable=SC2016
88
+
# $global must not be quoted because when it is empty this will break the command with a '' arg
0 commit comments