Generate SSH Keys

How to generate SSH Keys?

SSH Keys are a security mechanism introduced in SSH (Secure Shell).

It use asymetric criptography (a pair of keys also refered as public key and private key) to provide secure communications and authentication both of the server and client.

  1. Open an Bash shell (Linux or Mac). If working on Windows, open the GitBash console.
  2. Type the following command adapting the sample with your email:
    ssh-keygen -t rsa -b 4096 -C ""
  1. When asked where to store the keys, press intro to accept default file (or choose a nama for it if you like a different one).
  2. When asked for a passphase, choose a passphase to protect it.
  3. Default location for keys in Linux or Mac is inside the folder: ~/.ssh/.
  4. Default location in Windows is the folder %USERPROFILE%/.ssh/.
  5. To configure a web site to push code like Github, Bitbucket or Azure Devops, you need to open the file containing the public key (with extension .pub) and add it to the website under your account settings. It will have the following form:
    ssh-rsa AAAAB3Nza...Yr3GcDWj6owKI3vhAciQQX email@machine
  6. Copy & paste the content of the key in the target website.

To Remeber

To known much more on SSH keys visit SSH Keys.