KeyShoe's Blog

Git SSH

Enabling SSH Access to GitHub

Here I want to put down the steps I did to enable ssh access from my machine to github so that I don’t have to login everytime.

1. Install OpenSSH

2. Generate SSH Key Pair

ssh-keygen -t ed25519 -C "your_email@example.com"

3. Start SSH Agent and Add Key

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

4. Add SSH Public Key to GitHub Account

5. Test SSH Connection

ssh -T git@github.com
> The authenticity of host 'github.com (IP ADDRESS)' can't be established.
> ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
> Are you sure you want to continue connecting (yes/no)?

Configure Git for Commit Signing

Now to configure git to make sure to sign all my commits, so that all our commits are shown as verified on github.

1. Configure GPG Format

git config --global gpg.format ssh

2. Set Signing Key

git config --global user.signingkey /PATH/TO/.SSH/KEY.PUB

3. Enable Automatic Commit Signing

git config --global commit.gpgsign true
git push

Additional Notes

git commit -S -m "YOUR_COMMIT_MESSAGE"

#Git #Learning #Programming