
Configuring SSH Key for Github
In this Tutorial we are going to configure something that is very simple, but that can give you headaches the first time that you are trying to make it work, and is to configure you Git account with secret keys in Linux (Ubuntu in our case).
Installing GIT
Write the following commands on the terminal:
sudo apt-get update
sudo apt-get install gitNow, to verify the installation, execute:
git --versionIn my case, it shows “git version 2.7.4”.
Creating the public and private keys
Now, we have to create the public and private RSA keys in your machine.
Type in the terminal
mkdir ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa -b 4096Then, enter the configuration details (or press enter to give them the default values). Then, it will show you the randomart image and you are done with the creation. You should be reading something like this:

So, this is telling to you that the keys were generated and the ssh key is located in “/home/gonzalo/.ssh/id_rsa” (replace “gonzalo” for your user name) .
Now, you have to add the public SSH Key into your SSH Agent:
sudo ssh-add /home/<your username>/.ssh/id_rsa
Some times, depending in your linux configuration, you could have the message “Could not open a connection to your authentication agent.”. In that case, you should execute:
eval `ssh-agent -s`Now execute the ssh-add command again :)
Copy&Paste the Keys into GitHub (Or other Git Service)
Now, go to your GitHub account and access the configuration:
Profile Pic/Settings/SSH and GPG KeysThen, press the “New SSH Key” button:

It will show you the following form:

Now, go back to your terminal and execute this command:
cat ~/.ssh/id_rsa.pubit will show you the content of the public key stored in your machine:

Copy the content, paste it in the GitHub Form and press the “Add SSH Key” button:

Finally, setup your .gitconfig
git config --global user.name "<your username>"
git config --global user.email your@email.comAnd you are ready! Now you can start using Git. Test it cloning some repository.
If you have any doubt or if something is not working for you, please leave a comment and I will help you as soon I read the comment.
Happy Coding!
Gonzalo.
