rlipscombe
Mix.install doesn't honour `GIT_SSH_COMMAND`
When I use Mix.install with a git dependency, using git@github.com:... how do I change the SSH identity used?
I’ve got two Github accounts – work and personal, and usually I’d specify GIT_SSH_COMMAND=ssh -i path/to/private_key -o IdentitiesOnly=yes.
This works fine when running, say, iex and Mix.install in my terminal. When I try the same in Livebook, I get the following error:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
I’ve tried editing .livebookdesktop.sh – and the env var is set properly according to System.get_env; didn’t work.
I’ve tried using system_env: %{"GIT_SSH_COMMAND" => "ssh -i ... in Mix.install; didn’t work.
How do I get Mix.install to use alternate SSH identities inside Livebook?
Marked As Solved
rlipscombe
Summary:
Mix.installuses thegitcommand normally, so environment variables and configuration settings should just work.- If you’re using SSH, it will need access to your private keys. This requires access to a running
ssh-agentwith those keys. - If you’re managing your
ssh-agentwith a login script, etc., you’ve probably got more than onessh-agentrunning. - On macOS (at least), Livebook will be talking to the
launchd-startedssh-agent. - This one won’t have your keys.
- Sad times.
Also Liked
rlipscombe
I’ve already got the extra private key, so: yes.
Moreover, in order to apply the .insteadOf option, I need a configuration file. And, because I’m keeping my personal and work configurations separate, it’s a separate configuration file.
And, if I could persuade Mix.install to use a separate configuration file, I wouldn’t need the env var – because the configuration file already specifies core.sshCommand, but that doesn’t seem to do anything here either.









