-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mix deps.get - Error fetching private repo on GitHub using :github option #3422
Comments
The github option only works with public repos. Private repos require the path as you have specified. |
Thanks for the fast reply! Perhaps the example for the docs at http://elixir-lang.org/getting-started/mix-otp/dependencies-and-umbrella-apps.html#internal-dependencies should be updated from
to
Following the format of the original example results in the same error I have encountered. |
That would then only work for private repos and not public ones. :) We should add a note about private repos though. |
I just tried the following and I have no problems fetching from the public
and here's the corresponding
|
Ah, that's a good point. However, wouldn't still require you to have authentication on all of your servers? For example, once you deploy, you would need to have an SSH key that can access Github on the server. If that is the case, I still don't think it is worth doing this change. Just be explicit if you have a private repo. |
I see your point now, for the alternative format to work even for public repos, it needs an GitHub account/project associated SSH key being present. I agree there isn't a need for mix to change, and yes, updating the docs example would help since that's the first resource I found on using private dependencies, and I couldn't get the example to work. |
@josevalim I'm needing to grab a dependency from a private git repo but the ssh key pair includes a passphrase, how can I set that passphrase on the mix file? |
It is not recommended to put ssh passphrases in the mix.exs file. There are different ways you can configure ssh so it applies to a certain host. However, if you really need to use ssh keys in the URL, then I recommend using url rewrite in your
So you will use |
I think the proper solution were to use an ssh-agent of your choice and to
unlock the key before fetching the deps. The alternative is of course to
change the passphrase to an empty one, but that's probably not the thing
you actually want to do.
…----------
*edit* remove quoted mail text.
|
There is a need just to give read access like using deployment keys of bitbucket. For this it would be great if there is some way that I can put my read only access deployment key inside project and specify path in mix file to fetch that dependency |
Note: I was having this problem with bitbucket and windows. I had to switch to the https version of the repo url to get it working. |
GitLab CI needs a (https) url containing a gitlab-ci-token to fetch private repositories. Fetching a private repo like this only works locally, not in CI: A workaround is to put the GitLab url in a variable in
Then use the environment variable in
Note that when a dependency also needs to fetch a (nested) dependency the parent |
Git also knows how to manage credentials, so you can store the credentials on git directly and keep using bare URLs in your mix.exs: https://git-scm.com/docs/gitcredentials |
That would mean not using a ssh key to fetch dependencies from GitLab right? |
You can use ssh hosts for that. For example, in your .ssh/config you could do:
And now you declare this as your git repo in mix.exs and everywhere: orggitlab:path/to/repo - Each person can define their own host, user and pass on their ssh config. Not saying this is the way to go, just providing options. :) |
That's pretty clever but it would probably not solve the fetching private repos in GitLab CI problem right? |
I'm using Elixir 1.0.4 and git 2.4.4.
mix deps.get
is unable to fetch my private Github repo when it is specified using the:github
option as follows inmix.exs
The output
However, it works perfectly when I specify the mixfile using the standard :git option as follows
Am I missing something obvious?
The text was updated successfully, but these errors were encountered: