Glide: bitbucket: issue in glide getting a private repository

Created on 27 Jan 2017  Â·  5Comments  Â·  Source: Masterminds/glide

There's a small issue when glide getting a private repository in Bitbucket:

$ glide install
[INFO]  Lock file (glide.lock) does not exist. Performing update.
[INFO]  Downloading dependencies. Please wait...
[INFO]  --> Fetching bitbucket.org/brenol/psa
[WARN]  Unable to checkout bitbucket.org/brenol/psa
[ERROR] Update failed for bitbucket.org/brenol/psa: Access Denied

However, if the following is set in the glide.yaml file:

- package: bitbucket.org/brenol/psa
  repo: [email protected]:brenol/psa
  version: 1.x
  vcs: git

It works flawlessly:

[INFO]  --> Fetching bitbucket.org/brenol/psa
[INFO]  --> Detected semantic version. Setting version for bitbucket.org/brenol/psa to v1.0.7
[INFO]  Resolving imports
[INFO]  --> Fetching github.com/dgrijalva/jwt-go
[INFO]  --> Detected semantic version. Setting version for github.com/dgrijalva/jwt-go to v3.0.0
[INFO]  --> Fetching github.com/gorilla/mux
[INFO]  --> Detected semantic version. Setting version for github.com/gorilla/mux to v1.3.0
[INFO]  --> Fetching updates for github.com/pkg/errors
[INFO]  --> Detected semantic version. Setting version for github.com/pkg/errors to v0.8.0
[INFO]  --> Fetching github.com/gorilla/context
...

Any ideas on why this happens and where the fix should happen? I'd be glad to provide a fix if necessary.

Thanks!

Most helpful comment

Hitting this now, and I think one option would be allowing a flag to put in the repository URL. Something like:

$ glide get bitbucket.org/owner/repo [email protected]:owner/repo.git

At the moment I'm just having to edit the glide.yaml file manually every time I want to add a dependency like this.

All 5 comments

@brenol
The default for glide (just like go get tool) is to use https.
I tested https://bitbucket.org/brenol/psa and it's a private repo so the best option is to use ssh in the repo attribute like you did.

Well, the main issue is that go get uses the. gitconfig file... which means
it should follow the .gitconfig file just like go get, which uses the tule
that it should use SSH insteadOf https.

I think this is pretty fair, but IM not sure. What do you think?

Em 27 de jan de 2017 18:02, "Francisco Guimarães" notifications@github.com
escreveu:

@brenol https://github.com/brenol
The default for glide (just like go get tool) is to use https.
I tested https://bitbucket.org/brenol/psa and it's a private repo so the
best option is to use ssh in the repo attribute like you did.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Masterminds/glide/issues/752#issuecomment-275760545,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHAKaTWCf1gg4mg6uFVdEXXVA6fsaD53ks5rWk1igaJpZM4LwHu9
.

Well, my answer was based on your issue description and you didn't mentioned about using .gitconfig file.
If you are using .gitconfig file this works.

- package: bitbucket.org/brenol/psa
  version: 1.x
  vcs: git

You have at least to inform which vcs system your package is using.

Glide deals with a lot of vcs system and it has a seperate repository for this.
https://github.com/Masterminds/vcs

Given a go package, eg bitbucket.org/brenol/psa, the default URL is https://bitbucket.org/brenol/psa.
When glide has just the default URL info (which in turn does not say anything about vcs system) it tries to guess the vcs system.

In the case of bitbucket it could be git or mercurial. So glide tries to ask the bitbucket API which vcs system the repository is using. Because this repository is private glide receives the error Access Denied from the Bitbucket API.

You can check most of the logic here
https://github.com/Masterminds/vcs/blob/master/vcs_remote_lookup.go#L81.

Maybe the solution here (to cover not setting the vcs manually) would be implementing bitbucket authentication using a consumer key.

You are correct. I forgot to mention go get and .gitconfig and so on, I am
sorry.

I will take a look as to why go get has no issues even though it also deals
with Mercurial and Git, as far as I remember.

Thank you!

Em 28 de jan de 2017 07:42, "Francisco Guimarães" notifications@github.com
escreveu:

Well, my answer was based on your issue description and you didn't
mentioned about using .gitconfig file.
If you are using .gitconfig file this works.

  • package: bitbucket.org/brenol/psa
    version: 1.x
    vcs: git

You have at least to inform which vcs system your package is using.

Glide deals with a lot of vcs system and it has a seperate repository for
this.
https://github.com/Masterminds/vcs

Given a go package, eg bitbucket.org/brenol/psa, the default URL is
https://bitbucket.org/brenol/psa.
When glide has just the default URL info (which in turn does not say
anything about vcs system) it tries to guess the vcs system.

In the case of bitbucket it could be git or mercurial. So glide tries to
ask the bitbucket API which vcs system the repository is using. Because
this repository is private glide receives the error Access Denied from
the Bitbucket API.

You can check most of the logic here
https://github.com/Masterminds/vcs/blob/master/vcs_remote_lookup.go#L81.

Maybe the solution here (to cover not setting the vcs manually) would be
implementing bitbucket authentication
https://confluence.atlassian.com/bitbucket/use-the-bitbucket-cloud-rest-apis-222724129.html#UsetheBitbucketCloudRESTAPIs-Authentication
using a consumer key.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Masterminds/glide/issues/752#issuecomment-275838281,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHAKaS6COVhPaF1CqJAh4ZZpL8GVfHTxks5rWw2FgaJpZM4LwHu9
.

Hitting this now, and I think one option would be allowing a flag to put in the repository URL. Something like:

$ glide get bitbucket.org/owner/repo [email protected]:owner/repo.git

At the moment I'm just having to edit the glide.yaml file manually every time I want to add a dependency like this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ryanwalls picture ryanwalls  Â·  4Comments

mh-cbon picture mh-cbon  Â·  3Comments

gitwangjian picture gitwangjian  Â·  6Comments

diwakergupta picture diwakergupta  Â·  6Comments

jaxxstorm picture jaxxstorm  Â·  3Comments