diff --git a/pkg/git/read.go b/pkg/git/read.go index 69081322..1d9f7acd 100644 --- a/pkg/git/read.go +++ b/pkg/git/read.go @@ -2,6 +2,7 @@ package git import ( "io/ioutil" + "os" "os/user" "path" "path/filepath" @@ -93,7 +94,13 @@ func parseGitConfig() (*gitConfigPkg.Config, error) { return nil, err } - b, err := ioutil.ReadFile(usr.HomeDir + "/.gitconfig") + globalGitConfig := filepath.Join(usr.HomeDir, ".gitconfig") + if _, err := os.Stat(globalGitConfig); os.IsNotExist(err) { + logrus.Debugf("no %s exists, not reading any global git ignore config", globalGitConfig) + return cfg, nil + } + + b, err := ioutil.ReadFile(globalGitConfig) if err != nil { return nil, err }