opengist/internal/git/config.go
2024-11-21 11:23:57 +01:00

23 lines
426 B
Go

package git
import "os/exec"
func InitGitConfig() error {
configs := map[string]string{
"receive.advertisePushOptions": "true",
"safe.directory": "*",
}
for key, value := range configs {
if err := setGitConfig(key, value); err != nil {
return err
}
}
return nil
}
func setGitConfig(key, value string) error {
cmd := exec.Command("git", "config", "--global", key, value)
return cmd.Run()
}