Skip to content

Instantly share code, notes, and snippets.

@ibnsamy96
Last active March 27, 2025 02:58
Show Gist options
  • Save ibnsamy96/801f3fd8adc3cb9ce606ac78c05e6480 to your computer and use it in GitHub Desktop.
Save ibnsamy96/801f3fd8adc3cb9ce606ac78c05e6480 to your computer and use it in GitHub Desktop.
authenticating new github account to the git cli using ssh
  1. Create the ssh public key using this command in the terminal, enter the command and follow all the presented steps
    ssh-keygen -t ed25519 -C <account_email>
  2. Terminal will show the path of the file which has the public key in your system, copy that path and open it.
    cat <file_path> ## ~/.ssh/id_ed25519.pub
  3. You'll see the key, copy all the file content and go to this page https://github.com/settings/keys and click New SSH key.
  4. In the opened page, use any understandable title, use Authentication Key as key type, and add the copied key to the key box.
  5. Add your commits user name and password using these two commands:
    git config --global user.name <account_name> ## use quotations to use space in the name
    git config --global user.email <account_email>
  6. Clone any of your repos to check that everything is ok.

For using more than one account on the same machine, check this gist: https://gist.github.com/rahularity/86da20fe3858e6b311de068201d279e3.

Notes:

  • Remember to use ed25519 algorithm while creating the key not rsa.
  • Don't use -k while adding keys to the ssh-agent on linux.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment