title: SSH Private Key Permissions using Git GUI or ssh-keygen are too open
body: <p>Recently I've been unable to clone or push to github, and I'm trying to find the root cause.</p>
  
  <p><em>This is on windows</em></p>
  
  <p>I have cygwin + git as well as msysgit.</p>
  
  <p>Msysgit was installed with the following options:</p>
  
  <ul>
  <li>OpenSSH</li>
  <li>Use Git from Windows Command Prompt</li>
  </ul>
  
  <p>That gives me 4 environments to try to use git in:</p>
  
  <ul>
  <li>Windows cmd prompt</li>
  <li>Powershell</li>
  <li>Git Bash</li>
  <li>Cygwin</li>
  </ul>
  
  <p>Somehow I've managed to get myself into a position where when I try to clone a repository using msysgit, cmd.exe, or Powershell, I get the following error:</p>
  
  <pre><code>&gt; Initialized empty Git repository in
  &gt; C:/sandbox/SomeProject/.git/
  &gt; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  &gt; @    WARNING: UNPROTECTED PRIVATE KEY FILE!          @
  &gt; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  &gt; Permissions 0644 for
  &gt; '/c/Users/Ben/.ssh/id_rsa' are too
  &gt; open. It is recommended that your
  &gt; private key files are NOT accessible
  &gt; by others. This private key will be
  &gt; ignored. bad permissions: ignore key:
  &gt; /c/Users/Ben/.ssh/id_rsa Permission
  &gt; denied (publickey). fatal: The remote
  &gt; end hung up unexpectedly
  </code></pre>
  
  <p>This is using the .ssh folder in my c:\users\ben\ folder, which is what is used by msysgit. <em>I suspect cygwin works because the .ssh folder is located elsewhere, but I'm not sure why</em></p>
  
  <p>In Git Bash, I check the permissions:</p>
  
  <pre><code>$ ls -l -a ~/.ssh
  </code></pre>
  
  <p>Which gives me:</p>
  
  <pre><code>drwxr-xr-x    2 Ben      Administ        0 Oct 12 13:09 .    
  drwxr-xr-x   34 Ben      Administ     8192 Oct 12 13:15 ..    
  -rw-r--r--    1 Ben      Administ     1743 Oct 12 12:36 id_rsa
  -rw-r--r--    1 Ben      Administ      399 Oct 12 12:36 id_rsa.pub    
  -rw-r--r--    1 Ben      Administ      407 Oct 12 13:09 known_hosts
  </code></pre>
  
  <p>These permissions are apparently too relaxed.  How they got this way, I have no idea.</p>
  
  <p>I can try to change them...</p>
  
  <pre><code>$ chmod -v -R 600 ~/.ssh
  </code></pre>
  
  <p>which tells me:</p>
  
  <pre><code>mode of `.ssh' changed to 0600 (rw-------)
  mode of `.ssh/id_rsa' changed to 0600 (rw-------)
  mode of `.ssh/id_rsa.pub' changed to 0600 (rw-------)
  mode of `.ssh/known_hosts' changed to 0600 (rw-------)
  </code></pre>
  
  <p>But it seems to have no effect.  I still get the same error, and doing </p>
  
  <pre><code>$ ls -l -a ~/.ssh
  </code></pre>
  
  <p>yields the same permissions as before.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I tried to fix the permissions to those files in cygwin, and cygwin reports their permissions correctly, gitbash does not:
  <a href="http://cdn.cloudfiles.mosso.com/c54102/app7962031255448924.jpg">alt text http://cdn.cloudfiles.mosso.com/c54102/app7962031255448924.jpg</a></p>
  
  <p>Any ideas on how I can really fix these permissions?</p>