Skip to content

Instantly share code, notes, and snippets.

@jryannel
Last active June 22, 2022 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jryannel/4a9a82929d0de89d88be6954821bb347 to your computer and use it in GitHub Desktop.
Save jryannel/4a9a82929d0de89d88be6954821bb347 to your computer and use it in GitHub Desktop.
Executes git command
// ExecGit executes a git command.
func ExecGit(args ...string) error {
log.Debugf("exec git %s", args)
_, err := exec.LookPath("git")
if err != nil {
log.Warnf("git not found")
return err
}
err = exec.Command("git", args...).Run()
if err != nil {
log.Warnf("git %s failed", args)
return err
}
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment