bower / registry

The Bower registry
https://registry.bower.io/packages
MIT License
292 stars 66 forks source link

bower register https/ssh fails #4

Closed sindresorhus closed 10 years ago

sindresorhus commented 11 years ago

When trying to register a package using an https url, Bower fails with a generic error message.

bower register screenfull https://github.com/sindresorhus/screenfull.js.git
bower error Incorrect format

This works fine however:

bower register screenfull git://github.com/sindresorhus/screenfull.js.git
registered screenfull to git://github.com/sindresorhus/screenfull.js.git

Sidenote: The error message is not very descriptive either, at first I thought it was the package

asbjornenge commented 11 years ago

Since this hasn't been fixed for 5 month's I hope it's a bit more severe than just fixing the regexp in validate? :-P

def validate
  super
  errors.add(:url, 'is not correct format') if url !~ /^git:\/\//
end
sindresorhus commented 11 years ago

That should do it.

benschwarz commented 11 years ago

Can we also include "a better error message" as part of the scope of this?

"Please use git:// or https:// urls" would be a huge improvement.

satazor commented 11 years ago

The ssh and https protocols can reference public and private repositories. One cannot simply allow registration without actually attempting to fetch them. If it fails with an authentication failure it means it's private. Otherwise it's public. @danheberden perhaps we need to include this in the server rewrite.

seancurtis commented 10 years ago

@danheberden @satazor is there any eta on when this will be fixed? I have a package on Bitbucket I want to register but am unable to because of this bug :(

mingos777 commented 10 years ago

@seancurtis Welcome to the club :/

seancurtis commented 10 years ago

@danheberden @benschwarz @satazor is there an update on this? I'd really love to be able to publish my Fancy File Input (https://bitbucket.org/atlassianlabs/fancy-file-input/) component to Bower.

benschwarz commented 10 years ago

@sheerun any thoughts on how bitbucket repos play into auth?

sheerun commented 10 years ago

They apparently don't support git:// prefix, and when trying to register https:// version I get:

bower register fancy-file-input https://bitbucket.org/atlassianlabs/fancy-file-input.git
bower                       EINVFORMAT The registry only accepts URLs starting with git://

Why not allow https urls?

ikari-pl commented 10 years ago

So... we're never gonna be able to register a bitbucket public repo?

JasonBerry commented 10 years ago

… or any other host that doesn't support the Git protocol.

cheshrkat commented 10 years ago

Just adding a +1 to supporting hosts-other-than-github ;)

haukurmar commented 10 years ago

I agree, I am in the same boat here, I want to register my Bitbucket repos.

Is there any reason bower shouldn't support https?

If not can someone please fix this? :)

kode4food commented 10 years ago

I'm in the same boat. My project is hosted on bitbucket and I have no interest in migrating it over to github. If the git CLI can access my repo, why shouldn't bower also be able to? Fix it, please

kode4food commented 10 years ago

I was able to bypass the problem by adding:

[url "https://"]   
    insteadOf = git://

to my ~/.gitconfig file. At least I think it worked for publishing

Of course, it doesn't help people trying to actually 'retrieve' the package. Unless they've done the same

benschwarz commented 10 years ago

@kode4food "Fix it, please" is only going to make project maintainers want to shoot this issue to the moon.

@sheerun As far as I'm aware, https protocol is disabled because we use --depth 1 and github enterprise/https has issues.

It'd be good to recover from shallow clone errors and use a full clone… Thoughts?

kode4food commented 10 years ago

Was 'please' not the right word? Seems not very different than "If not can someone please fix this? :)" Should I have added a smiley face?

gerbsen commented 10 years ago

Hey, any updates? I would really like to publish my bower component from my bitbucket repository :( :+1:

sheerun commented 10 years ago

I guess we can implement this in 1.4.x and disable --depth for https repositories.

PR is welcome.

kode4food commented 10 years ago

@sheerun that would be fantastic, thanks!

dgieselaar commented 10 years ago

In the meantime, is there a workaround?

sheerun commented 10 years ago

You can put repo url as dependency version.

{
  "dependencies": {
    "foo": "https://bitbucket.org/foo/foo.git#1.2.3"
  }
}

or something like that.

dgieselaar commented 10 years ago

@sheerun thanks!

edit: never mind, unable to get that to work. @kode4food Have you been able to register a bower component with just that in your .gitignore file? How does the register command look?

kode4food commented 10 years ago

@plestik Can't remember the command, but I believe I was registering it like "bower register interpol git://..." The registration works, but users would have to make the same .gitconfig change in order to retrieve the package. So it really didn't solve the problem.

satazor commented 10 years ago

As I said earlier, the problem is not the --depth (that is a whole separate issue). The issue is that we must ensure the repo you are trying to register is public. The git:// protocol is public only, while https or ssh can point to both public and private. To allow other protocols, we must ensure that we are able to fetch them without auth. This must be done in the bower/registry server.

@sheerun please don't simply remove the constraint without actually doing the validation I'm mentioning above, otherwise we will have a complete mess of other issues.

kumar303 commented 10 years ago

I was seeing this error and finally found out the problem was that I was trying to register the package as FxPay when my git URL was in lower case as fxpay. When I changed everything to lower case it worked.

rayshan commented 10 years ago

@kumar303 b/c spec says lowercase only, however we need better error messages