Do you ever ask yourself, “What is GitHub?” or wish you had an opportunity to learn the basics of Git? If you’ve always wanted to use GitHub, but haven’t quite been able to get up to speed. In this “Github for beginners” post, you will get introduced to Github & its various commands. It talks about Github pages, repo, installs Git, Git commands & desktop, hosting with Jekyll, etc for complete newbies. This beginner-friendly article is for you.

1. What is Github?

Github is a web-based hosting service for version control using Git. Github is a place where developers store their open source software projects and networks with like-minded people and work together without any conflicts. Github provides access control and several collaboration features like creating repositories, pull requests, merge, commits, branches, etc for each and every project to make developer life better.

GitHub is a code hosting platform for collaboration and version control. GitHub lets you (and others) work together on projects.
Github = Git(Version Control System) & Hub(Code hosting platform).

2. What is Git?

Git is an Open Source DISTRIBUTED VERSION CONTROL SYSTEM. It is mainly used for source code management in software development. It is a Command Line Interface(CLI) tool and can be mastered easily.

3. What is Version Control System?

Version control systems are a category of software tools that help a software team manage changes to source code over time. Version control software keeps track of every modification to the code in a special kind of database. If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.

VCS treats each file/change as a revision and coordinates work on those change among multiple people providing information like who edited or created it, when, what changes were made, etc. It also provides the ability to revert a file/change to a previous revision for allowing editors to track each other’s edits, correct mistakes, and defend against vandalism and spamming. VCS can be distributed or centralized, but distributed has more advantages.

This development doesn’t depend on a single entity as VCS tends to be distributed. Each entity is treated with equal importance as others.

Developers can review project history to find out:

  • Which changes were made?
  • Who made the changes?
  • When were the changes made?
  • Why were the changes needed?

4. What is GitHub Pages?

GitHub Pages is a static site hosting service designed to host your personal, organization, or project pages directly from a GitHub repository. You can create and publish GitHub Pages sites online using the Jekyll Static site generator Or if you prefer to work locally, you can use GitHub Desktop or the command line. GitHub Pages doesn’t support server-side code such as PHP, Ruby, or Python.

Ready to get started?
Build your own site from scratch or generate one for your project.
You get one site per GitHub account and organization, and unlimited project sites.
Let's get started at Github pages.

5. How to install Git in pc?

Install Git on Windows. Download the latest Git for Windows installer. When you’ve successfully started the installer, you should see the Git Setup wizard screen. Open a Command Prompt (or Git Bash if during installation you elected not to use Git from the Windows Command Prompt).

Before you start using Git, you have to make it available on your computer. Even if it’s already installed, it’s probably a good idea to update to the latest version. You can either install it as a package or via another installer or download the source code and compile it yourself.

Git is responsible for everything GitHub-related that happens locally on your computer.

To use Git on the command line, you’ll need to download, install, and configure Git on your computer.

If you want to work with Git locally, but don’t want to use the command line, you can instead download and install the GitHub Desktop client.

Download & install latest version of Git at official Git downloads page.

6. What is Github Desktop?

GitHub Desktop is a fast and easy way to contribute to projects from Windows and OS X, whether you are a seasoned user or new user, GitHub Desktop is designed to simplify the all process and workflow in your GitHub and replace GitHub for Mac and Windows with a unified experience across both platforms. GitHub Desktop is an open source Electron-based GitHub app written in TypeScript and uses React.

Github Desktop Image.

GitHub Desktop will allow us to easily start using version control. GitHub Desktop offers a Graphical User Interface(GUI) to use Git. A GUI allows users to interact with a program using a visual interface rather than relying on text commands. Though there are some potential advantages to using the command line version of Git in the long run, using a GUI can reduce the learning curve of using version control and Git.

Extend your GitHub workflow beyond your browser with GitHub Desktop.
Get a unified cross-platform experience that’s completely open source and ready to customize.
Download latest version of Github desktop

7. How to Install GitHub Desktop?

You can download GitHub DesktopClassic” for Windows or OS X here. Once you have downloaded the file, unzip it and open the app, following the instructions for logging in to your GitHub account. Once you have installed GitHub Desktop and followed the setup instructions we can start using the software with a text document.

Here is the complete installation guide to install Github Desktop.

8. What are some basic Git Commands?

To use Git, developers use specific commands to copy, create, change, and combine code. These commands can be executed directly from the command line or by using an application like GitHub Desktop.

Here are some common commands for using Git:

  • git init: initializes a brand new Git repository and begins tracking an existing directory. It adds a hidden subfolder within the existing directory that houses the internal data structure required for version control.
  • git clone: creates a local copy of a project that already exists remotely. The clone includes all the project’s files, history, and branches.
  • git add: stages a change. Git tracks changes to a developer’s codebase, but it’s necessary to stage and take a snapshot of the changes to include them in the project’s history. This command performs staging, the first part of that two-step process. Any changes that are staged will become a part of the next snapshot and a part of the project’s history. Staging and committing separately gives developers complete control over the history of their project without changing how they code and work.
  • git commit: saves the snapshot to the project history and completes the change-tracking process. In short, a commit functions like taking a photo. Anything that’s been staged with git add will become a part of the snapshot with git commit.
  • git status: shows the status of changes as untracked, modified, or staged.
  • git branch: shows the branches being worked on locally.
  • git merge: merges lines of development together. This command is typically used to combine changes made on two distinct branches. For example, a developer would merge when they want to combine changes from a feature branch into the master branch for deployment.
  • git pull: updates the local line of development with updates from its remote counterpart. Developers use this command if a teammate has made commits to a branch on a remote, and they would like to reflect those changes in their local environment.
  • git push: updates the remote repository with any commits made locally to a branch.
Here is the complete list of Github commands.

9. What is a repository in Github?

A repository is like a folder for your project. Your project’s repository contains all of your project’s files and stores each file’s revision history. You can also discuss and manage your project’s work within the repository. You can own repositories individually, or you can share ownership of repositories with other people in an organization.</p>

Create a new repository in Github.

  1. Go to Github.
  2. Log in to your account.
  3. Click the new repository button in the top-right. You’ll have an option there to initialize the repository with a README file, but I don’t.
  4. Click the "Create repository" button.
Create New Github Repository.

10. Can I host a website using Github pages?

Yes, we can host our personal website on Github as Github pages for free of cost. We use a static site generator called Jekyll to serve as a CMS for the publishers and the GitHub. Importantly, we can use our own custom domain to get hosted on the Github.

Here is the complete guide to host a website using Github pages.

11. What is Jekyll?

Jekyll is a static site generator, which in reduced terms means that it will let you develop a website with some dynamic-like functionalities like automatic navigation menus, cross-links and so on; but the end result is actually just generated as static files (files that only need to be served, not computed). Jekyll Static files only need to be hosted on a web server (which makes it cheap) and are easily deployable. You give it text written in your favorite markup language and it churns through layouts to create a static website. Throughout that process, you can tweak how you want the site URLs to look, what data gets displayed in the layout, and many more.

Github Pages: Jekyll Homepage.

Most, importantly, we can blog with Jekyll, as you were reading this article, my blog(Karunakar Patel blog) is hosted on Github served as Github pages for free by using Jekyll.

GitHub Pages are powered by Jekyll, so you can easily deploy your site using GitHub for free—custom domain name and all.

Let's get started at Jekyll(static site generator) →

12. How to add a custom domain name to Github Pages?

Go to your GitHub Pages site’s repository settings. Under “Custom domain”, add or remove your custom domain and click “Save”. Setting “custom domain” creates a file named CNAME in the same repository. That’s it we add a custom domain name to Github.

Learn more about adding a custom domain name to Github pages

13. How to secure the Github Pages site with HTTPS?

HTTPS adds a layer of encryption that prevents others from snooping on or tampering with traffic to your site. You can enforce HTTPS for your GitHub Pages site to transparently redirect all HTTP requests to HTTPS.

Here is how to add HTTPS to Github Pages.

  1. On GitHub, navigate to the main page of the repository.
  2. Under your repository name, click Settings.
  3. Under "GitHub Pages," select Enforce HTTPS.
Learn more at adding HTTPS to Github pages.
The same technique I used to add HTTPS to my Karunakar Patel Blog.

14. What are the usage limits of GitHub Pages?

GitHub Pages sites are subject to the following usage limits:

  1. GitHub Page's source repositories have a recommended limit of 1GB.
  2. Published GitHub Pages sites may be no larger than 1 GB.
  3. GitHub Pages sites have a soft bandwidth limit of 100GB per month.
  4. GitHub Pages sites have a soft limit of 10 builds per hour.

If your site exceeds these usage quotas, we may not be able to serve your site, or you may receive a polite email from GitHub Support or GitHub Premium Support suggesting strategies for reducing your site’s impact on our servers, including putting a third-party content distribution network(CDN) in front of your site, making use of other GitHub features, such as releases, or moving to a different hosting service that might better fit your needs.

GitHub Pages is not intended for or allowed to be used as a free web hosting service to run your online business, e-commerce site, or any other website that is primarily directed at either facilitating commercial transactions or providing commercial software as a service (SaaS).