lib/utils/downloadTemplateFromRepo.js/parseRepoURL
function parseRepoURL(inputUrl) {
  return new BbPromise((resolve, reject) => {
    if (!inputUrl) {
      return reject(new ServerlessError('URL is required'));
    }

    const url = URL.parse(inputUrl.replace(/\/$/, ''));

    // check if url parameter is a valid url
    if (!url.host) {
      return reject(new ServerlessError('The URL you passed is not a valid URL'));
    }

    if (url.hostname === 'github.com' || url.hostname.indexOf('github.') !== -1) {
      return resolve(parseGitHubURL(url));
    } else if (url.hostname === 'bitbucket.org') {
      return resolve(parseBitbucketURL(url));
    } else if (url.hostname === 'gitlab.com') {
      return resolve(parseGitlabURL(url));
    }

    const msg =
      'The URL you passed is not one of the valid providers: "GitHub", "GitHub Entreprise", "Bitbucket", "Bitbucket Server" or "GitLab".';
    const err = new ServerlessError(msg);
    // test if it's a private bitbucket server
    return retrieveBitbucketServerInfo(url)
      .then(isBitbucket => {
        if (!isBitbucket) {
          return reject(err);
        }

        // build download URL
        return resolve(parseBitbucketServerURL(url));
      })
      .catch(() => reject(err));
  });
}