Skip to content

Commit

Permalink
check git configuration before exec world create
Browse files Browse the repository at this point in the history
  • Loading branch information
zulkhair committed Aug 28, 2024
1 parent ef6982b commit 55608ae
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions common/teacmd/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
}

_, err := sh.Exec(env, &outBuff, &errBuff, "git", args...)
if err != nil {
return "", err
}
Expand Down Expand Up @@ -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 <[email protected]>\"", "-m", initMsg)
if err != nil {
return err
}
Expand Down

0 comments on commit 55608ae

Please sign in to comment.