diff --git a/src/package-managers/gitTags.ts b/src/package-managers/gitTags.ts index 2af8e5a4..2db30c49 100644 --- a/src/package-managers/gitTags.ts +++ b/src/package-managers/gitTags.ts @@ -20,13 +20,15 @@ const getSortedVersions = async (name: string, declaration: VersionSpec, options const protocolKnown = protocol != null if (protocolKnown) { tagsPromise = tagsPromise.then(() => - remoteGitTags(`${protocol ? protocol.replace('git+', '') : 'https:'}//${auth ? auth + '@' : ''}${host}/${path}`), + remoteGitTags( + `${protocol ? protocol.replace('git+', '') : 'https:'}//${auth ? auth + '@' : ''}${host}/${path?.replace(/^:/, '')}`, + ), ) } else { // try ssh first, then https on failure tagsPromise = tagsPromise .then(() => remoteGitTags(`ssh://git@${host}/${path}`)) - .catch(() => remoteGitTags(`https://${auth ? auth + '@' : ''}${host}/${path}`)) + .catch(() => remoteGitTags(`https://${auth ? auth + '@' : ''}${host}/${path?.replace(/^:/, '')}`)) } // fetch remote tags