cli icon indicating copy to clipboard operation
cli copied to clipboard

Improve error message if git URL isn’t http(s):// based

Open AndreasPizsa opened this issue 4 years ago • 9 comments

Got this message:

? Are you using GitHub Enterprise? No
ERR! semantic-release Error: GitHub repository URL is invalid: https:undefined.git

This was caused by the repo being SSH based, not HTTP(s). Took a while to figure this out, a clearer error message would make sense and make this easily fixable.

Code here: https://github.com/semantic-release/cli/blob/d2b48b0ef70e327ae591a3a6cd502fadc9b59333/src/lib/repository.js#L14-L28

Associated issue here:

Just for reference and in case someone else is having this problem in the future.

I stumbled upon this issue with the exact same error message, but it was caused due to an invalid git repository URL in the package.json.

Maybe we should put up some FAQ for this error?

Originally posted by @Inkdpixels in https://github.com/semantic-release/cli/issues/1#issuecomment-222634278

AndreasPizsa avatar Nov 20 '19 13:11 AndreasPizsa

I’d like to fix this but I would need more info.

We use Gitlab, open-source, self-hosted.

Our repo URLs are SSH by default, that’s ok, I can switch it to use HTTPS, BUT then I need to specify a private key in the auth part of the origin URL.

Line 23 throws away auth though.

https://github.com/semantic-release/cli/blob/d2b48b0ef70e327ae591a3a6cd502fadc9b59333/src/lib/repository.js#L20-L30

I assume that line is there for a reason - do you remember what that reason was @pvdlg ?

AndreasPizsa avatar Nov 20 '19 16:11 AndreasPizsa

I just set my repository remote origin URL to HTTPS and it's still showing this error. I'm using a self-hosted GitLab instance, and I can't get this to work. Are there any updates regarding this?

(does this CLI even support GitLab?)

matthew119427 avatar Jan 27 '20 02:01 matthew119427

Same here [email protected]:Lepardo/simplewebspider-nodejs.git and https://gitlab.com/Lepardo/simplewebspider-nodejs.git are leading to

$ npx semantic-release-cli setup
? Are you using GitHub Enterprise? No
ERR! semantic-release Error: GitHub repository URL is invalid: https:undefined.git

Barkole avatar Jun 21 '20 08:06 Barkole

It's 2021 can we fix this? Gitlab is a thing.

damusix avatar Jan 23 '21 00:01 damusix

not with that attitude. semantic-release is a kind, volunteer run project. I understand you are frustrated, but also I couldn't care less. Please don't go around making demands in Open Source projects

gr2m avatar Jan 25 '21 00:01 gr2m

I would gladly make a PR against it if you need the help, i dont mind contributing at all. Instead of replying in such a condescending manner, it would be much more productive to use that time to provide the info the previous commenters made so maybe they can make the PRs they were willing to make... hell, I would do it for them. I do apologize if i came off demanding, I thought a comment would be better than a +1.

damusix avatar Feb 02 '21 06:02 damusix

For the people getting this:

? Are you using GitHub Enterprise? No
ERR! semantic-release Error: GitHub repository URL is invalid: https:undefined.git

Just replace single repository attribute in package.json

"repository": "[email protected]/awesome-project.git",

for the object (with HTTPS Git URL):

"repository": {
    "type": "git",
    "url":  "https://gitlab.some.company/awesome-project.git"
},

davidgarsan avatar Jul 26 '21 11:07 davidgarsan

@davidgarsan These instructions don't work for me if I choose "No" to that question.

I'm also on Gitlab self-hosted. Looking at the code in src/lib/repository.js line:69, it looks like answering "No" immediately errors and prevents proceeding through the process. It all looks to be hardcoded to use GitHub and nothing else.

Thoughts?

csprocket777 avatar Dec 08 '23 17:12 csprocket777

Hi @csprocket777, since this workaround is from over two years it probably won't work in newer versions. Unfortunately I'm not longer working setting Gitlab and I'm unable to help further.

davidgarsan avatar Dec 09 '23 15:12 davidgarsan