code: func (c *Configuration) Remote() string {
  	ref := c.CurrentRef()
  
  	c.loading.Lock()
  	defer c.loading.Unlock()
  
  	if c.currentRemote == nil {
  		if len(ref.Name) == 0 {
  			c.currentRemote = &defaultRemote
  			return defaultRemote
  		}
  
  		if remote, ok := c.Git.Get(fmt.Sprintf("branch.%s.remote", ref.Name)); ok {
  			// try tracking remote
  			c.currentRemote = &remote
  		} else if remotes := c.Remotes(); len(remotes) == 1 {
  			// use only remote if there is only 1
  			c.currentRemote = &remotes[0]
  		} else {
  			// fall back to default :(
  			c.currentRemote = &defaultRemote
  		}
  	}
  	return *c.currentRemote
  }
docs: // Remote returns the default remote based on:
  // 1. The currently tracked remote branch, if present
  // 2. Any other SINGLE remote defined in .git/config
  // 3. Use "origin" as a fallback.
  // Results are cached after the first hit.