lib/utils/downloadTemplateFromRepo.js/parseBitbucketServerURL
function parseBitbucketServerURL(url) {
  const pathLength = 9;
  const parts = url.pathname.split('/');
  const isSubdirectory = parts.length > pathLength;
  const owner = parts[5];
  const repo = parts[7];

  const query = qs.parse(url.query);
  const branch = 'at' in query ? decodeURIComponent(query.at) : 'master';

  const downloadUrl = `${url.protocol}//${url.hostname}/rest/api/latest/projects/${owner}/repos/${repo}/archive${url.search}&format=zip`;

  return {
    owner,
    repo,
    branch,
    downloadUrl,
    isSubdirectory,
    pathToDirectory: getPathDirectory(pathLength + 1, parts),
    auth: url.auth || '',
  };
}