How to Generate a Public Key for GIT
- 1). Open your terminal. In Linux or Unix, there will usually be a terminal shortcut in the menu. Under Mac OS X, you can open it by clicking "Spotlight" and typing "Terminal." Under Windows, your first impulse may be to open the Windows command prompt, but do not. Instead, click "Start," "Git," and select "Git BASH." This will allow you to use the version of the Linux BASH shell included with Git and access the commands you need to create your keypair.
- 2). Type the command "cd ~/.ssh" to enter the ".ssh" directory in your user's home folder. If you receive a "No such directory" error, that is fine. Simply skip Step 3 and go on to Step 4.
- 3). Type the following commands to backup your current SSH keys in a directory named "key_backup":
mkdir key_backup
cp id_rsa* key_backup
rm id_rsa* - 4). Type the following to generate a new SSH key:
ssh-keygen -t rsa -C "your_email@address.com"
If prompted for a filename, just hit "Enter." - 5). Enter a password when asked. This will be used to access the SSH key. If you want, you can just hit Enter to have no password, but it is not recommended, since anyone who obtains your SSH key file will be able to access anything you have locked with your public key.
Source...