code: func Init(s storage.Storer, worktree billy.Filesystem) (*Repository, error) {
  	if err := initStorer(s); err != nil {
  		return nil, err
  	}
  
  	r := newRepository(s, worktree)
  	_, err := r.Reference(plumbing.HEAD, false)
  	switch err {
  	case plumbing.ErrReferenceNotFound:
  	case nil:
  		return nil, ErrRepositoryAlreadyExists
  	default:
  		return nil, err
  	}
  
  	h := plumbing.NewSymbolicReference(plumbing.HEAD, plumbing.Master)
  	if err := s.SetReference(h); err != nil {
  		return nil, err
  	}
  
  	if worktree == nil {
  		r.setIsBare(true)
  		return r, nil
  	}
  
  	return r, setWorktreeAndStoragePaths(r, worktree)
  }
docs: // Init creates an empty git repository, based on the given Storer and worktree.
  // The worktree Filesystem is optional, if nil a bare repository is created. If
  // the given storer is not empty ErrRepositoryAlreadyExists is returned