71

GitHub distributes a simplified Git client for Windows they call GitHub for Windows; it authenticates via GitHub account, and although it usually uses HTTPS remotes for local repositories it creates, if you tell it to use an existing local repository that has an SSH remote on GitHub, it will use your GitHub credentials to set up an SSH key on the GitHub account for itself. But where does it keep the SSH key in the filesystem?

rakslice
  • 7,846
  • 3
  • 47
  • 51
  • This was quite a long time ago; the behaviour of the current GitHub Desktop software may be different. – rakslice Oct 30 '18 at 22:30
  • I've updated the link to point to the Wayback Machine copy of the GitHub for Windows help page I linked as the original is gone. – rakslice Dec 03 '18 at 06:31

5 Answers5

97

%HOMEDRIVE%%HOMEPATH%\.ssh\id_rsa.pub is where the key is.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
neuro_tarun
  • 1,202
  • 10
  • 8
29

On my work PC it is in %USERPROFILE%/.ssh/ and not %HOMEDRIVE%%HOMEPATH%/.ssh/.

On many computers those folders are the same location, but it depends on the configuration. So it seems %USERPROFILE% is the location used by GitHub for Windows, which is also the ~ home location for its Git Bash.

This is confusing since my Windows Git default installation uses %HOMEDRIVE%%HOMEPATH% as its ~ home location.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
t3hmun
  • 411
  • 4
  • 8
13

The default location is: %HOMEDRIVE%%HOMEPATH%\.ssh\id_rsa.pub. That would expand to something like C:\Users\dennis\.ssh\id_rsa.pub.

If %HOMEDRIVE%%HOMEPATH%\.ssh\id_rsa.pub already exists, GitHub creates a key named github_rsa(.pub) in the same folder.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Dennis van der Schagt
  • 2,315
  • 2
  • 28
  • 31
5

It's in %HOMEDRIVE%%HOMEPATH%\.ssh.

Note that GitHub for Windows normally uses SSL; SSH keys won't have been created unless you've used an SSH repository with it at some point.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
rakslice
  • 7,846
  • 3
  • 47
  • 51
1

On my Windows 10 Home the .ssh folder's path is %HOMEDRIVE%%HOMEPATH%\AppData\Roaming\SPB_Data\.ssh

schlebe
  • 2,315
  • 2
  • 27
  • 39
runovskyi
  • 11
  • 3
  • Isn't there a shorter form? Something like `%USERPROFILE%\AppData\Roaming\SPB_Data\.ssh`? Or even shorter, like [`%APPDATA%\SPB_Data\.ssh`](https://ss64.com/nt/syntax-variables.html)? – Peter Mortensen Aug 30 '20 at 18:16