From 55608ae89a58ca586f3b574b088e97442c94bc92 Mon Sep 17 00:00:00 2001 From: zulkhair Date: Wed, 28 Aug 2024 01:54:10 +0700 Subject: [PATCH] check git configuration before exec world create --- common/teacmd/git.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/common/teacmd/git.go b/common/teacmd/git.go index 53d2243..5a613be 100644 --- a/common/teacmd/git.go +++ b/common/teacmd/git.go @@ -32,7 +32,14 @@ type GitCloneFinishMsg struct { func git(args ...string) (string, error) { var outBuff, errBuff bytes.Buffer - _, err := sh.Exec(nil, &outBuff, &errBuff, "git", args...) + + // Define environment variables + env := map[string]string{ + "GIT_COMMITTER_NAME": "World CLI", + "GIT_COMMITTER_EMAIL": "no-reply@world.dev", + } + + _, err := sh.Exec(env, &outBuff, &errBuff, "git", args...) if err != nil { return "", err } @@ -94,7 +101,7 @@ func GitCloneCmd(url string, targetDir string, initMsg string) error { return err } - _, err = git("commit", "-m", initMsg) + _, err = git("commit", "--author=\"World CLI \"", "-m", initMsg) if err != nil { return err }