diff --git a/lib/get-git-auth-url.js b/lib/get-git-auth-url.js index ca9e1fb763..0c35cd299d 100644 --- a/lib/get-git-auth-url.js +++ b/lib/get-git-auth-url.js @@ -14,8 +14,11 @@ const debug = require('debug')('semantic-release:get-git-auth-url'); * @return {String} The formatted Git repository URL. */ function formatAuthUrl(protocol, repositoryUrl, gitCredentials) { - const [match, auth, host, basePort, path] = /^(?!.+:\/\/)(?:(?.*)@)?(?.*?):(?\d+)?:?\/?(?.*)$/.exec(repositoryUrl) || []; - const {port, hostname, ...parsed} = parse(match ? `ssh://${auth ? `${auth}@` : ''}${host}${basePort ? `:${basePort}` : ''}/${path}` : repositoryUrl); + const [match, auth, host, basePort, path] = + /^(?!.+:\/\/)(?:(?.*)@)?(?.*?):(?\d+)?:?\/?(?.*)$/.exec(repositoryUrl) || []; + const {port, hostname, ...parsed} = parse( + match ? `ssh://${auth ? `${auth}@` : ''}${host}${basePort ? `:${basePort}` : ''}/${path}` : repositoryUrl + ); return format({ ...parsed,