• Suppose you are new to git and github and you want to use it quickly. This is the situation I write this post.
    1. Get a free account of github, that’s easy for you guys.
    2. Install the git on Windows or Linux, that’s easy too.
    3. Then I use the Ubuntu as an example.

configure your git local

  • After you install git, open git bash and configure you git, like your user name and email of your github account.git official tutorial
    1
    2
    $ git config --global user.name "John Doe"
    $ git config --global user.email johndoe@example.com

    Generating a new SSH key

  • Then get your local ssh key and copy it to your github account, git official tutorial
    1
    $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  • This creates a new ssh key, using the provided email as a label.
    1
    Generating public/private rsa key pair.
  • When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location.
    1
    Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
  • At the prompt, type a secure passphrase. And if you want to skip the password, just press Enter twice and it will be done.
    1
    2
    Enter passphrase (empty for no passphrase): [Type a passphrase]
    Enter same passphrase again: [Type passphrase again]

    Adding your SSH key to the ssh-agent

  • After you generate your ssh key, go to the destination and open the id_rsa.pub and copy the contents like this:
  • Then log in your github account and find the setting part
  • And then from the left menu to find the SSH and GPG Keys
  • Click the right button and add new ssh key
  • You will be asked add the title and ssh key

    Testing your ssh connection with github

  • Now go back to your git bash, and type into
    1
    ssh -T git@github.com
  • You will get the response like this
  • That means you connect to your github successfully! Congratuations!

Next step

  • Since you have configured your git and github, let’s do a simple practice now. Go to Part2