Setup Git + Github With Ssh On Linux
Setup git + GitHub with ssh on Linux
Akbar S. Ahmed | Jan 5, 2014

Step-by-step instructions

Step-by-step instructions on how to setup git and GitHub with ssh authentication on Linux.

Install git

sudo apt-get install git

Set your git username

git config --global user.name "your-github-username"

Set your email

git config --global user.email "your-github-email-address"

Setup the password cache

We’ll setup our password to cache for 1 hour for repos that we access via https.

git config --global credential.helper cache

git config --global credential.helper 'cache --timeout=14400'

Create a new ssh key

ssh-keygen -t rsa -C "your-github-email-address"

Add your ssh key to GitHub

vi ~/.ssh/id_rsa.pub

Open a browser to www.github.com and perform the following actions after logging in.

  • Click Account Settings.
  • Click SSH Keys in the left pane.
  • Click Add SSH key.
  • Enter the following in Title: Development SSH key.
  • Paste your key into Key.
  • Click Add key.

Verify that everything is setup correctly

ssh -p 22 -T git@github.com

The output should look like:

The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is XX:XX:XX:XX:XX:XX:XX:XX.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of known hosts.
Hi your-github-username! You've successfully authenticated, but GitHub does not provide shell access.



Subscribe to our newsletter

Contact Information

ABOUT EXPONENTIAL.IO

We specialize in helping professional developers, like you, expand your skill set. Our courses are focused on enabling you to learn everything necessary to use a new technology in a live, production application.

LOCATION

All courses are made with love in
Palo Alto, CA.

Subscribe to our newsletter