rlipscombe

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

rlipscombe

Summary:

  • Mix.install uses the git command 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-agent with those keys.
  • If you’re managing your ssh-agent with a login script, etc., you’ve probably got more than one ssh-agent running.
  • On macOS (at least), Livebook will be talking to the launchd-started ssh-agent.
  • This one won’t have your keys.
  • Sad times.

Also Liked

rlipscombe

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.

Where Next?

Popular in Questions Top

New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement