Basic Introduction to GitHub (Part 1)

GitHub is the largest code-hosting platform in the world. It uses Git as version control and the repository is based on GitHub. Features such as Pull Requests, Project Boards and GitHub are central and found in one place.

Sign up for a Free Account

To start using GitHub, please go to https://github.com/join and follow the instruction

Creating a PAT of SSH Key

A PAT is a string of characters that can be used in place of a password against the GitHub API and on command lone.

You may need to understand the various scopes on GitHub such as repo, admin: repo_hook, users etc. For more information, do take a look at https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes

For starters, you may want to go to https://github.com/settings/tokens and click on Generate new token

On Linux, you can generate your SSH key using the email that you have created in your GitHub User Account

[user1@node1 ~]$ ssh-keygen -t rsa -C "myemail_used_in_Github@hotmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
/home/user1/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user1/.ssh/id_rsa.
Your public key has been saved in /home/user1/.ssh/id_rsa.pub.
The key fingerprint is:
........
........

Adding the SSH Key to the ssh-agent

Although this is not mandatory, adding the SSH Key to the SSH Agent is a good practice that will keep the SSH Key safe. The SSH-agent is an SSH Key Manager that helps to keep the SSH key safe because it protects your SSH keys from being exported. The SSH Agent also saves you from having to type the passphrase you create. every time your SSH key is used.

Before you check, you want to check your ~/.ssh/config first

$ vim ~/.ssh/config
Host * 
AddKeysToAgent yes

At the Terminal,

$ ssh-add ~/.ssh/id_rsa

Copy your SSH Public Key to the field. In your ~/.ssh/config, it should have a .pub extension like id_rsa.pub

Configuring Git

To intialise the Git. Do the following. You may want to take a look at

[user1@node1 ~]$ git config --global user.name "Melvin Soh"
[user1@node1 ~]$ git config --global user.email "kittycool@hotmail.sg"
[user1@node1 ~]$ git config --global init.defaultBranch main
[user1@node1 ~]$ git config --list
credential.helper=netrc -f ~/.netrc.gpg -v
user.name=user1
user.email=myemail_used_in_Github@hotmail.com
init.defaultbranch=main

To continue, See Basic Introduction to GitHub (Part 2)

References:

  1. 1.5 Getting Started – Installing Git
  2. 1.6 Getting Started – First-Time Git Setup