-
Open Terminal
-
Check if you already have a SSH keypair generated. Do the following:
$ ls -la ~/.ssh/id_rsa*
If the files exist, you already have SSH installed. IMPORTANT: But if you wish to regenerate the SSH key pair, at least back up your old SSH keys.
$ cp ~/.ssh/id_rsa ~/.ssh/id_rsa.old # Make a copy of the old SSH private key $ cp ~/.ssh/id_rsa.pub ~/.ssh/id_rsa.pub.old # Make a copy of the old SSH public key
-
Generate a 4096-bit key pair - yes, use the higher bit
$ ssh-keygen -t rsa -b 4096 -C "[email protected]" # Creates a new ssh key, using the provided email as a label Generating public/private rsa key pair.
-
Enter a file in which you want to save your keys. You can press enter and the default
~/.ssh/id_rsa
will be used.Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
-
Enter a passphrase. Read Github working with SSH key passphrase articule on why you should use a passphrase and at the same time you don't have to enter the passphase everytime you use your SSH key.
Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again]
-
From here on your SSH key pair is generated, your SSH public key is
~/.ssh/id_rsa.pub
- the one with thepub
extension. BE EXTRA CAREFUL when using your~/.ssh/id_rsa
file. This is your private key, guard it properly.
- Install Git for Windows
- Open Git Bash and repeat the above instructions