title: "Permission denied" error from Visual Studio Code and Visual Studio (but not Git Bash)
body: <p>With a new work laptop running Windows 10, I have installed <code>git</code>, <code>Visual Studio Code</code> and <code>Visual Studio 2019</code>. After making some test changes to code in from my personal git repo (hosted on <code>github</code>), I am trying to commit and push those changes to the remote repo.</p>
  <p>I can perform all of the <code>Stage</code>, <code>Commit</code> and <code>Push</code> actions from <code>Git Bash</code>. But in Git Gui, VS Code and VS 2019, <code>Stage</code> and <code>Commit</code> both work fine, but <code>Push</code> fails with an error message.</p>
  <p>For VS Code the error is:</p>
  <pre><code>git@github.com: Permission denied (publickey).
  fatal: Could not read from remote repository.
  </code></pre>
  <p>And for VS 2019 the error is similar:</p>
  <pre><code>git@github.com: Permission denied (publickey).
  Error encountered while pushing to the remote repository: Git failed with a fatal error.
  Could not read from remote repository.
  </code></pre>
  <p>How do I resolve this?</p>
  <h3>Update</h3>
  <p>The comment from @DaemonPainter helped lead to the answer. My private SSH key files were named <code>id_rsa_github</code> and <code>id_rsa_github.pub</code>. Visual Studio 2019, Code and Git Gui all expect these to be named <code>id_rsa</code> and <code>id_rsa.pub</code>.</p>
  <p>The solution is to add a <code>config</code> file to <code>%HOMEPATH%\.ssh</code> with contents similar to this:</p>
  <pre><code>host github.com
   HostName github.com
   IdentityFile ~/.ssh/id_rsa_github
  </code></pre>
  <p>After making that change, <code>git push</code> works in Git Bash, Gut Gui, VS Code and Visual Studio.</p>