func GitListRemotes() []string {
	remotes, err := GitRemotes()
	if err != nil {
		return []string{}
	}
	return remotes
}
GitListRemotes get all remotes. In case of error, it returns an empty array.
package main
import (
	"bytes"
	"io/ioutil"
	"os/exec"
	"regexp"
	"strings"
	"syscall"
)
func hasGitCommand() bool {
	_, err := exec.LookPath("git")
	return err == nil
}
func isInsideGitWorkTree() bool {
	_, err := git("rev-parse", "--is-inside-work-tree")
	if err != nil {
		return false
	}
	return true
}
func git(subcmd string, args ...string) (string, error) {
	gitArgs := append([]string{subcmd}, args...)
	var out bytes.Buffer
	cmd := exec.Command("git", gitArgs...)
	cmd.Stdout = &out
	cmd.Stderr = ioutil.Discard
	err := cmd.Run()
	if exitError, ok := err.(*exec.ExitError); ok {
		if waitStatus, ok := exitError.Sys().(syscall.WaitStatus); ok {
			if waitStatus.ExitStatus() != 0 {
				return "", err
			}
		}
	}
	return strings.TrimRight(strings.TrimSpace(out.String()), "\000"), nil
}
func GitRemotes() ([]string, error) {
	out, err := git("remote")
	if err != nil {
		return []string{}, err
	}
	return regexp.MustCompile("\r\n|\n\r|\n|\r").Split(out, -1), nil
}