How to install and setup Git for the first time

This article will help you to install and setup Git on Ubuntu for the first time. The same process can also be used to setup git on Windows and on Macintosh.
On Windows you may need to install Git Bash to use Git and follow below process.
This will also solve the problem of "permission denied (publickey) git clone" error message.

 
 
First to install git type in following command
 "sudo apt-get install git" and then yes for the question asked.
 
Then type in "ssh -T git@github.com" , if you see Hi username! You've successfully authenticated, but GitHub does not
# provide shell access. Then you are good to go without doing anything below, if not then follow all instructions below.
  1. cd ~/.ssh 
  2. ls to check whether already keys exists or not. If there is no any file names id_rsa or id_rsa.pub. If these files exist then go to 3 or else 2. 
  3. ssh-keygen -t rsa -C "your_email@example.com" This will create these two files for you. Remember "your_email@example.com" is your git registered email address only.
  4. Hit "Enter" for how many times it will ask you something over there.
  5. vi id_rsa.pub to edit this file.
  6. Copy everything in it till the end. End will be with your email id.
  7. Open github.com. 
  8. Go to Account settings, it is at the top right corner just besides your user id second icon.
  9. Click on SSH Keys.
  10. Then add SSH key
  11. Give a title and paste that key which we've copied from id_rsa.pub and click Add key button.
  12. Go to your terminal again and type in this command "ssh -T git@github.com".
  13. You will definitely get this message  "Hi username! You've successfully authenticated, but GitHub does not
    # provide shell access.". if not you must have missed something. 
  14. Type your issue in comment box I will try to post solution as soon as possible.
  15. If you see above message that means you are ready to use git. 
  16. Play around with it and enjoy Giting. :)
 
 
 
Author
No comments available.