My Avatar

LanternD's Castle

An electronics enthusiast - survive technically

Set GitHub SSH Key For Password-free Push


I need to do this on every new machine. So I keep a note for my quick reference.


Here are the links for the detailed configurations and so on.


  1. $ ssh-keygen -t ed25519 -C ""

    You will be asked about the secure passphrase. I prefer letting it empty. Otherwise you need to enter this password every time you git push.

  2. $ eval "$(ssh-agent -s)": Test whether the SSH agent work or not.
  3. $ ssh-add ~/.ssh/id_ed25519
  4. cat ~/.ssh/ copy the output of this command
  5. Go to the GitHub personal setting -> “SSH and GPG keys” on the left panel -> “New SSH key” -> Paste the above output to the input.
  6. Test: ssh -T


    The authenticity of host ' (' can't be established.
    RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added ',' (RSA) to the list of known hosts.
    Hi <your_username>! You've successfully authenticated, but GitHub does not provide shell access.
  7. Done.

Change the Local Repo’s Remote Address

Assume your project is awesome-project, then edit url in awesome-project/.git/config.

Before: url = https://<your_github_username><your_github_username>/awesome-project.git

After: url =<your_github_username>/awesome-project.git


Now you don’t need to enter password again when git push or git pull.

Disqus Comment 0