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 email@example.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.
- cd ~/.ssh
- 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.
- ssh-keygen -t rsa -C "firstname.lastname@example.org" This will create these two files for you. Remember "email@example.com" is your git registered email address only.
- Hit "Enter" for how many times it will ask you something over there.
- vi id_rsa.pub to edit this file.
- Copy everything in it till the end. End will be with your email id.
- Open github.com.
- Go to Account settings, it is at the top right corner just besides your user id second icon.
- Click on SSH Keys.
- Then add SSH key
- Give a title and paste that key which we've copied from id_rsa.pub and click Add key button.
- Go to your terminal again and type in this command "ssh -T firstname.lastname@example.org".
- 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.
- Type your issue in comment box I will try to post solution as soon as possible.
- If you see above message that means you are ready to use git.
- Play around with it and enjoy Giting. :)