Generate New SSH Key in Windows

I am still new to this and can’t seem to find the answer elsewhere. I made a stupid mistake, and when I pushed my first project code to github, I accidentally pushed a file that contained my SSH key. Thankfully Github has blocked use of that key automatically. Now I am trying to create a new key to use on github, but Windows seems to be producing the same key every time I run the following command:

ssh-keygen -t rsa -b 2048

How can I go about creating a different key to use? Thanks.

Hi @zernst3, welcome to the GitHub Support Community! I’m glad our secret scanning blocked the key automatically :smiley:

Could you please confirm what software versions you’re using and the exact steps you’re taking? After generating a key, you should get a “randomart” graphical representation of the key, like this:

The key's randomart image is:
+---[RSA 2048]----+
|                 |
|                 |
|               . |
|              o .|
|        S   . .=+|
|       . . ++*+++|
|        . +O=+@+ |
|         .o=XO=*.|
|         ..+OXE+o|
+----[SHA256]-----+

That’s for a test key I just made with the same parameters you used. Are you getting this image after generating a key? If so, can you confirm that it is the same each time - if, somehow, OpenSSH is generating the same key, that image would be the same each time. I am not a cryptography expert, but I’m actually not aware of any way this could happen in OpenSSH.

If you get different images, can you confirm that the file you are trying to use is the key that has actually been generated? Deleting all unused SSH keys from your computer and generating a new one would be one way to ensure this.

You may find Connecting to GitHub with SSH useful.

Let me know if this helps! If not, we can look a bit closer at what’s going on.