1

Goal: non-interactively pull a github repo with a nodejs script using the child-process module

Setup: On my linux box I've set up github to work with ssh to the point were I can pull and push without entering passwords using ssh agent

Issue: When my nodejs script tries to pull, it ask for the passphrase for my private key. Not helpful given I want it to run on its own. I was under the impression that the agent would act on by behalf here. Particularly given the script is running as my user. Obviously I'm wrong about that. Keep in mind "git pull" just pulls interactively without a passphrase normally with my set up via ssh

Question: This part of the script works with https setup, but I'm interested, what do I need to change to run this script hands off whilst I've got ssh going on?

Sorry, I'm sure this has been asked in some form before now, but its a bit hard to search this one without getting issues of not being able to set ssh up

1

If there is passphrase on the SSH key it will always be asked at some point. However SSH caches that so an interactive user is not asked to re-enter the passphrase very often.

The passphrase on the SSH protect the SSH key if it is compromised (hacked system, stolen laptop, stolen backup disk). There are cases where it is less useful to protect it and a passpĥrase-less SSH key can be used.

4
  • So there is not a way for ssh to cache for non-interactive just as it does for interactive? – Paul Beaudet Aug 17 '17 at 15:36
  • I guess in this case where the key exist on an encrypted hard drive anyhow I probably should just create a passphrase-less key – Paul Beaudet Aug 17 '17 at 15:40
  • 1
    1) AFAIK SSH doesn't make a difference between interactive and non-interactive use. You see a difference because if course entering the password in non-interactive mode is a lot more disruptive. 2) yes, a key without passphrase can be OK, especially if the user has no write/update access to the repo, or if the key is only usable inside a private network... – xenoid Aug 17 '17 at 21:07
  • Does ssh cache the passphrase, or does ssh-agent do that for you? If it is ssh-agent, then perhaps @PaulBeaudet needs to interactively add the passphrase to his agent before he runs the non-interactive script. – Qsigma Dec 31 '17 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.