code: func Init(ctx context.Context, path, userName, userEmail string) (*Git, error) {
  	g := &Git{
  		path: path,
  	}
  	// the git repo may be empty (i.e. no branches, cloned from a fresh remote)
  	// or already initialized. Only run git init if the folder is completely empty
  	if !g.IsInitialized() {
  		if err := g.Cmd(ctx, "Init", "init"); err != nil {
  			return nil, errors.Errorf("failed to initialize git: %s", err)
  		}
  		out.Red(ctx, "git initialized at %s", g.path)
  	}
  
  	if !ctxutil.IsGitInit(ctx) {
  		return g, nil
  	}
  
  	// initialize the local git config
  	if err := g.InitConfig(ctx, userName, userEmail); err != nil {
  		return g, errors.Errorf("failed to configure git: %s", err)
  	}
  	out.Red(ctx, "git configured at %s", g.path)
  
  	// add current content of the store
  	if err := g.Add(ctx, g.path); err != nil {
  		return g, errors.Wrapf(err, "failed to add '%s' to git", g.path)
  	}
  
  	// commit if there is something to commit
  	if !g.HasStagedChanges(ctx) {
  		out.Debug(ctx, "No staged changes")
  		return g, nil
  	}
  
  	if err := g.Commit(ctx, "Add current content of password store"); err != nil {
  		return g, errors.Wrapf(err, "failed to commit changes to git")
  	}
  
  	return g, nil
  }
docs: // Init initializes this store's git repo