SSH Key Setup for GitHub

To understand Github you first need to make sure you are aware of a Git . Git is a open source version control system that was started by Linus Trovalds. In short Git is a version control system like Subversion and CVS. You will be able to use this by installing “git” command and utilities in your server. Git is a command-line tool, and GitHub is the place where developers store their projects and works and will be able to share with the rest of the world and can give them version upgrades as well. You have options to create private and public repositories and can use them as per your needs.

To start with you need to make sure you have a linux terminal with git command installed and have ability of using git command by the user at which you are trying. Always try to use a separate user and do not use root user for the same. Also you need to create a account with Github.

Create an Account with Github

To create a account with Github, you can follow the below steps

  • Go to “Join GitHub”
  • Fill in your information and click “Create an account”
  • Select the plan you want and click “Finish sign up”
  • When you sign up, you’ll receive an email to verify your email address.  Click the link to complete verification.

Once account is created next step is to create a fresh key pair and then add them to Github.

Adding Your SSH Key to Your GitHub Account

Login to your terminal via SSH.

Generate a key pair by running the following command, substituting in your GitHub email address between the quotes:

# ssh-keygen -t rsa -b 4096 -C “”

When you’re prompted to “Enter a file in which to save the key,” press Enter to save it in the default location. If you wish to use a different location, you can provide the path to be used here as well.

At the prompt, type a secure passphrase that will be used when your key is authenticating, and confirm it. You can even do not setup this passphrase if you don’t need extra verification. So now you have generated the SSH key pair. Make sure you make a note on things like public key and private key files.

To add ssh key in the GitHub you need to take a copy of the public key and you can use the below ssh command to get this done.

# cat /home/user/.ssh/

Once you have copied the content in your clipboard or in any local text file, we can use the below steps to add the key to Github account.

  • You need to login to Github Account using your user/pass
  • Click on the Profile pic and select “Settings” from the Drop down.
  • Select “SSH and GPG Keys” from the Menu in the left hand side

To add your first key or another key click on “New SSH key”

In the “Title” field, you need to add a label which you can remember.  (I used  “Sumesh’s MacBook Air”).

You can use any word and only thing you need to take care is you need to make sure that will help you to identify the machine on which that key is generated.

In “key” Field add the above key which you get by using the command “cat /home/user/.ssh/” which will start with ssh-rsa

  • Click Add SSH key.

If prompted, confirm your GitHub password which will be used for verification.

Now you can see the key listed which you have added in the title name. And you will need to do the same procedure for each computer , live servers dev/staging servers which needs to access your repositories.

Check your Connection from local machine to Github

Open a new ssh terminal and make sure you switch to the user for which you had created the ssh key pair. To connect with Github account via ssh key, you need to type the below and press enter

# ssh -T [email protected]

If you connecting this for the first time from that machine, you will see a result like the below and you need to type Yes in this case:

The authenticity of host ‘ (’ can’t be established.
RSA key fingerprint is SHA256:asdnasd871321312kjaksjdasdijsaidjsad1Rk3ndm.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘,’ (RSA) to the list of known hosts.
  • Type “yes”
  • Press Enter

You will see output like this:

“Hi user ! You’ve successfully authenticated, but GitHub does not provide shell access.”

If the above mentioned user is correct and is displayed as the same one which you tried adding, then all is fine and you have completed the ssh key setup with Github ! If you are getting permission denied, then we need to cross check the above steps and make sure you have done everything as per the above doc.  You can always contact me if you need any help in this case.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Git Compare Two Branches

Almost all version control systems have branching options. But Git is known for its fast branching capabilities. Git branches...

Emacs git Integration

How to use git in Emacs Download and config To get started using git in Emacs for version control, choose and install a...

Git Branch Basics

Basics of Git Branching The ability to easily branch is one of the best features of Git. Creating branches in other version...
Bài Viết

Bài Viết Mới Cập Nhật

Check proxy trên trang nào chuẩn nhất❓

Thuê Proxy chạy Google Ads / Cần chú ý gì khi chọn proxy và email chạy G.G ads?

Thuê proxy 4G ở đâu uy tín, giá rẻ, chất lượng?

Vì sao cần thuê proxy xoay? Địa chỉ cung cấp proxy xoay uy tín

Thuê proxy v6 kéo view Youtube ở đâu uy tín, chất lượng?