Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

"dep init" doesn't use local git configuration #831

Closed
usenkanov opened this issue Jul 15, 2017 · 5 comments
Closed

"dep init" doesn't use local git configuration #831

usenkanov opened this issue Jul 15, 2017 · 5 comments
Labels

Comments

@usenkanov
Copy link

usenkanov commented Jul 15, 2017

"go get" uses local git configuration when fetching dependencies. "dep init" doesn't behave in the same way.

Example:
We have a dependency which is in a private repo (e.g. code.xyz.internal). When we run the following:

go get code.xyz.internal/some-team/some-library.git

it succeeds, due to the following git configuration (within ~/.gitconfig)

[url "ssh://[email protected]:2222/"]
        insteadOf = https://code.xyz.internal/

which tells git where to look for a private repo. This will not, however, work with "dep init", which is expected to behave the same way as "go get".

What version of Go (go version) and dep (git describe --tags) are you using?

Go version: 1.8
Dep version: v0.1.0-215-g911cd22

What dep command did you run?

dep init -v
Output:
list versions for code.xyz.internal/some-team/some-library(): unable to deduce repository and source type for "code.xyz.internal/some-team/some-library": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://code.xyz.internal/some-team/some-library?go-get=1": Get http://code.xyz.internal/some-team/some-library?go-get=1: dial tcp: lookup code.xyz.internal: no such host

What did you expect to see?

Dependencies resolved correctly

What did you see instead?

see above

@matjam
Copy link
Contributor

matjam commented Jul 16, 2017

if you're using gitlab, https works. I posted an update to the FAQ on how to set it up.

#822

@ibrasho
Copy link
Collaborator

ibrasho commented Jul 16, 2017

These are not the same when using go get:

  • code.xyz.internal/some-team/some-library.git
  • code.xyz.internal/some-team/some-library

When passing a URL with no indicator of the CVS system, we rely on metadata to find the repository. That's why we pass the ?go-get=1 URL query and attempt to parse the page for the <meta> tags.

The error you posted is because you actually tried this for a non-existing URL (code.xyz.internal). I assume the error for the correct URL to be similar, but be the result of not being able to find the metadata.

@ibrasho
Copy link
Collaborator

ibrasho commented Jul 16, 2017

I'd recommend you create a Gopkg.toml with the following content:

[[constraint]]
  name = "code.xyz.internal/some-team/some-library"
  source = "code.xyz.internal/some-team/some-library.git"
  branch = "master

And try dep init again.

@ibrasho
Copy link
Collaborator

ibrasho commented Jul 16, 2017

This issue is related to #174 and #286.

@sdboyer
Copy link
Member

sdboyer commented Oct 26, 2017

closing this - the underlying issues remain, but this issue is duplicative of other outstanding issues.

@sdboyer sdboyer closed this as completed Oct 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants