mix deps.get dependency clone from git fails -- how to deal with prompted git credentials

405 views
Skip to first unread message

Brad O'Hearne

unread,
Mar 17, 2016, 12:01:23 AM3/17/16
to phoenix-talk
I have a Phoenix project which has a dependency that pulls from a private hosted git server, from a private repository which requires authentication to access. On my local machine, which is configured such that I do not have to authenticate every time I access the git repository, running 'mix deps.get' works just fine, and successfully clones the dependency into the deps directory. 

However, I have to work with a server with which such a git configuration is not possible (and I cannot change this), and accessing git requires entering credentials (both username and password) every time any repository on this private git server is accessed. When I run 'mix deps.get' on this server, I receive the following error:

Cloning into '/home/linuxos/Apps/MyApp/Web/my_app/deps/my_api'...
fatal: could not read Username for 'https://git.mygitserver.com': No such device or address
** (Mix) Command "git clone --no-checkout --progress "https://git.mygitserver.com/boh/my_api.git" "/home/linuxos/Apps/MyApp/Web/my_app/deps/my_api"" failed

The seems to be failing because there's no username, but unlike using a git command directly, it does not prompt for credentials. Is there some way to get Mix to prompt for git credentials? Again, I cannot configure these credentials in a configuration file on this server -- credentials need to be entered in at the time the command is run. 

Thanks, 

Brad

Eric Meadows-Jönsson

unread,
Mar 17, 2016, 5:39:33 AM3/17/16
to phoeni...@googlegroups.com
You can set the git url to https://username:pass...@git.mygitserver.com/boh/my_api.git. Other than that there are no other ways to do this in Mix because there are more proper ways to deploy. Check out releases and https://github.com/bitwalker/exrm.

--
You received this message because you are subscribed to the Google Groups "phoenix-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phoenix-talk...@googlegroups.com.
To post to this group, send email to phoeni...@googlegroups.com.
Visit this group at https://groups.google.com/group/phoenix-talk.
To view this discussion on the web visit https://groups.google.com/d/msgid/phoenix-talk/1b7a1ad0-869e-42e1-aaa0-007abaa0ef46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Eric Meadows-Jönsson

Brad O'Hearne

unread,
Mar 29, 2016, 1:02:46 PM3/29/16
to phoenix-talk
On Thursday, March 17, 2016 at 2:39:33 AM UTC-7, Eric Meadows-Jönsson wrote:
You can set the git url to https://username:password@git.mygitserver.com/boh/my_api.git. Other than that there are no other ways to do this in Mix because there are more proper ways to deploy. Check out releases and https://github.com/bitwalker/exrm.

Eric -- thanks for the feedback.  I actually am using Exrm, but I have some variables in the mix in my deployment environment which complicate things a bit....among other things development on a different OS than deployment, so I cannot use exrm to build for prod remotely and deploy the artifact to the target. Additionally, there are restrictions on the target which complicate the deployment scenario a bit, but I'm working through it. As a temporary workaround, if anyone else experiences the same problem, you can try git credential caching -- if you hit the repo from the command line prior to running mix, credentials will be temporarily cached, which will give enough time to run mix and grab dependencies. 

Thanks again for the help, Eric. 
Reply all
Reply to author
Forward
0 new messages