code: func (c *Client) DoWithAuth(remote string, access Access, req *http.Request) (*http.Response, error) {
  	res, err := c.doWithAuth(remote, access, req, nil)
  
  	if errors.IsAuthError(err) {
  		if len(req.Header.Get("Authorization")) == 0 {
  			// This case represents a rejected request that
  			// should have been authenticated but wasn't. Do
  			// not count this against our redirection
  			// maximum.
  			newAccess := c.Endpoints.AccessFor(access.url)
  			tracerx.Printf("api: http response indicates %q authentication. Resubmitting...", newAccess.Mode())
  			return c.DoWithAuth(remote, newAccess, req)
  		}
  	}
  
  	return res, err
  }
docs: // DoWithAuth sends an HTTP request to get an HTTP response. It attempts to add
  // authentication from netrc or git's credential helpers if necessary,
  // supporting basic and ntlm authentication.