Using a private git repository with Stack

722 views Asked by At

I'm trying to configure stack to use the Haskell packages of a private git repository. Looking at the documentation it seems that the git repository can be added as local dependency. The problem is that I see no way of specifying the credentials for logging into the server.

What is the right way of adding packages of a private git repository using stack?

EDIT: For the sake of completeness I add the section of stack.yaml that edited to be able to use a private repository:

packages:
- '.'
- location:
    git: ssh://[email protected]:7999/project/subproject.git
    commit: 4ac0e47bfd3
  subdirs:
  - subdir-of-the-private-package
  extra-dep: true

As @renegadeborealis pointed out, the authentication is taken care of outside of Stack.

1

There are 1 answers

0
renegadeborealis On BEST ANSWER

You'll set the authentication in Git itself, not in stack.

If you're using git over ssh, you can set authentication options in ~/.ssh/config

Host me.github.com
    HostName github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/me_rsa

Here's some good reading if you need more. Good luck!