Working with Github

I’m using Cygwin in the office for most of the Linux based tasks and one of them is using git. I’ve been trying to use my github account but failed several times. Finally, I have come up with the solution lately after tons of research and trial and error.

The Problem

When it is your first time in using github services (assuming you know the basics of git), you will eventually fail to push changes to your github repositories. First, you must have a github account. Assuming that you have not done anything unusual with your account, you will experience just what I’ve experience when trying to push changes.

Before pushing and wasting your time knowing that it will fail, just try this simple testing if your machine can connect to github.

$ ssh git [at] github [dot] com
Permission denied (publickey)

If you get the same result as above, the permission denied (publickey) error message, then I say welcome to the club! That is just part of being a newbie anyway. The message simply says that your public key was rejected by github because it is not integrated to your account.

The Simple Solution

The simple solution is to manually create you own public key and we will associate it to your github account later. Please note that the email address that you use for github must be the same as the email address you’ve used to create your public key.

Here is how to create your own public key.

$ ssh-keygen -C "your [at] email [dot] com" -t rsa

Make sure to enter a passphrase (your password). Your rsa public key will be saved under ~/.ssh/id_rsa.pub.

The next step is to open your github account via web and go to Account Settings. Find your email address from the list, usually there is one entry with your email address as the title. Click EDIT and paste (copy and paste) the key from ~/.ssh/id_rsa.pub then save your changes.

Now let’s try it again.

$ ssh git [at] github [dot] com
Enter passphrase for key '/home/YourUserName/.ssh/id_rsa':
PTY allocation request failed on channel 0
ERROR: Hi YourName! You've successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.

If that is what you get, it means we have just successfully configured our machine to connect to github. Try pushing changes to your repo and enjoy the service.

This entry was posted in GIT, Github and tagged , , , , . Bookmark the permalink.

Related Posts

2 Responses to Working with Github

  1. jojosiao says:

    Hi Lysender,

    hindi ko rin agad nakuha yung idea nyan.

  2. Lysender says:

    @jojosiao: Oo nga eh, wala siyang specific instructions kung paano i-integrate ang iyong rsa key sa github.

    In addition to my post, you can look at ~/.rsa/id_rsa.pub immediately if you don’t want to create a custom rsa key eg: if you already have one.

    Happy githubbing 😀

Leave a Reply

Your email address will not be published. Required fields are marked *