You are not logged in.

#1 2021-10-13 23:39:00

ThinkPad
Member
Registered: 2019-01-29
Posts: 87

Use GitHub with SSH key without entering username and password

I setup my key following these instructions and setup a passphrase for the key. GitHub only provides instructions for what I seek for Mac and Windows.

How do I setup my system so that GitHub doesn't request my password for every action?

Last edited by ThinkPad (2021-10-13 23:39:18)

Offline

#2 2021-10-14 03:12:30

YodaEmbedding
Member
Registered: 2021-10-13
Posts: 2

Re: Use GitHub with SSH key without entering username and password

1. Generate SSH public/private key pair for your current PC. Name it something useful like username@PC-Name. Run:

ssh-keygen -C "$(whoami)@$(uname -n)-$(date -I)"

2. Tell Github your SSH public key, usually located in

~/.ssh/id_rsa.pub

3. Change your .gitconfig so that git automatically translates non-SSH requests to SSH ones. https://stackoverflow.com/a/36500841/365102 suggests:

[url "ssh://git@github.com/"]
  insteadOf = https://github.com/

Here's my personal .gitconfig, if you're interested. Apparently, I was using the following, which also works:

[url "git@github.com:"]
    insteadOf = https://github.com

Fun fact: you can also auto-sign your commits using a GPG key.

Last edited by YodaEmbedding (2021-10-14 03:25:29)

Offline

Board footer

Powered by FluxBB