Use a private gitconfig file
This was changing my own ~/.gitconfig whenever run by hand outside of a container. Oops.
This commit is contained in:
parent
026c6814c8
commit
b36c6851a2
|
|
@ -555,6 +555,18 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
// Don't pollute the user's .gitconfig if this is being run directly.
|
||||
if f, err := os.CreateTemp("", "git-sync.gitconfig.*"); err != nil {
|
||||
log.Error(err, "ERROR: can't create gitconfig file")
|
||||
os.Exit(1)
|
||||
} else {
|
||||
gitConfig := f.Name()
|
||||
f.Close()
|
||||
os.Setenv("GIT_CONFIG_GLOBAL", gitConfig)
|
||||
os.Setenv("GIT_CONFIG_NOSYSTEM", "true")
|
||||
log.V(2).Info("created private gitconfig file", "path", gitConfig)
|
||||
}
|
||||
|
||||
// Capture the various git parameters.
|
||||
git := &repoSync{
|
||||
cmd: *flGitCmd,
|
||||
|
|
|
|||
Loading…
Reference in New Issue