Skip to content

Commit ed44eee

Browse files
Jerry XieJerry Xie
authored andcommitted
fix: check all git config scopes, not just --global
The previous implementation only checked --global git config, but users may have their git identity configured in: - Local repository config (.git/config) - System config (/etc/gitconfig) - Other scopes This change first tries --global, then falls back to checking all scopes if --global returns empty. This ensures we detect git configuration regardless of where it's set. Closes git config detection issue
1 parent b859bc0 commit ed44eee

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

internal/system/system.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,19 @@ func InstallHomebrew() error {
7070
}
7171

7272
func GetGitConfig(key string) string {
73+
// Try global first (most common)
7374
output, err := RunCommandSilent("git", "config", "--global", key)
74-
if err != nil {
75-
return ""
75+
if err == nil && output != "" {
76+
return output
77+
}
78+
79+
// Fall back to any available config (local, system, etc.)
80+
output, err = RunCommandSilent("git", "config", key)
81+
if err == nil {
82+
return output
7683
}
77-
return output
84+
85+
return ""
7886
}
7987

8088
func GetExistingGitConfig() (name, email string) {

0 commit comments

Comments
 (0)