GitHub: Permission denied (publickey). fatal: Could not read from remote repository

  1. Generate SSH key using ssh-keygen -t rsa -b 4096 -C "your email".
  2. Copy the output of cat ~/.ssh/id_rsa.pub to your clipboard
  3. Paste the above copied output to the form at https://github.com/settings/ssh/new

  • On your GitHub profile there is an Edit Profile button.
    It is located on top-right corner of the webpage.
  • Press it and you will see left Personal Settings menu.
  • Inside that menu find SSH and GPG keys option and press it.
  • You will see an option New SSH key to add new key.

  1. generate your key

    ssh-keygen

  2. Visualize your keys

    ls ~/.ssh

    id_rsa id_rsa.pub

  3. Start the agent

    eval ssh-agent

  4. Add your key to the agent

    ssh-add ~/.ssh/id_rsa