title: How can I make npm set the HOME environment variable correctly when running git?
body: <p>I have a <code>HOME</code> environment variable set in Windows to point to a folder, <code>C:\tom\</code>.</p>
  
  <p>When I run git from the command line, and it invokes ssh, it ends up looking for the <code>~/.ssh</code> folder, or <code>$HOME/.ssh</code>, and finds <code>C:\tom\.ssh</code>. This side of things works fine.</p>
  
  <p>When npm runs git, on the other hand, as it might when trying to get a dependency that refers to a private github repo, ssh seems to end up trying <code>C:\Users\tom\.ssh</code>, aka <code>%USERPROFILE%\.ssh</code>. But that folder doesn't exist on my PC, so ssh fails, because it can't find the <code>known_hosts</code> entry for github, and ultimately git fails:</p>
  
  <pre><code>npm ERR! Command failed: git -c core.longpaths=true fetch -a origin
  npm ERR! Host key verification failed.
  npm ERR! fatal: Could not read from remote repository.
  </code></pre>
  
  <p><code>npm config list</code> produces the following:</p>
  
  <pre><code>; cli configs
  user-agent = "npm/3.10.8 node/v6.9.1 win32 x64"
  
  ; builtin config undefined
  prefix = "C:\\Users\\tom\\AppData\\Roaming\\npm"
  
  ; node bin location = C:\Program Files (x86)\nodejs\node.exe
  ; cwd = C:\
  ; HOME = C:\Users\tom
  ; "npm config ls -l" to show all defaults.
  </code></pre>
  
  <p>So that makes sense, and presumably npm's HOME setting is coming through in the environment when it runs git. So I tried <code>npm config set HOME C:\tom</code>, hoping this would fix things... but it made no difference.</p>
  
  <p>How do I sort this out? I want ssh always to find <code>C:\tom\.ssh</code>. I don't ever want it to find <code>C:\Users\tom\.ssh</code>. How can I make that happen? I don't mind if I have to do this by tweaking some setting, if there's some option that stops npm modifying the environment, or something else.</p>