, ,

This is a quick note on using rebar with private git repositories that are password protected. Rebar itself has no facility for passing in authentication information, but it turns out that git under the hood uses curl to do HTTP Basic authentication. This means that with HTTP Basic authentication, you can create git users on the server and connect seamlessly without needing to specify a password on the client. Great for projects where you are mixing and matching public and private projects.

Assuming the server is already configured, then just add a .netrc to your user home directory with the below authentication information:

machine <git host>
login <git user>
password <password>

It’s important that the git URL should not specify the user in the URL, so it is pretty much a run-of-the-mill URL:

http://<git host>/<path>/<project>.git

Add the dependency to the rebar.config, and voila.