Setup git push.default
Fixes
@@ -51,6 +51,7 @@ func (s *Store) GitInit(alias, signKey, userName, userEmail string) error {
}
}
+ // set commit identity
if err := s.gitCmd("GitInit", "config", "--local", "user.name", userName); err != nil {
return err
}
@@ -58,6 +59,13 @@ func (s *Store) GitInit(alias, signKey, userName, userEmail string) error {
return err
}
+ // set push default, to avoid issues with
+ // "fatal: The current branch master has multiple upstream branches, refusing to push"
+ // https://stackoverflow.com/questions/948354/default-behavior-of-git-push-without-a-branch-specified
+ if err := s.gitCmd("GitInit", "config", "--local", "push.default", "matching"); err != nil {
+ return err
+ }
+
if err := s.gitAdd(s.path); err != nil {
return err
}
