Benjamin Semah | 12 Apr, 2023

What Is GitHub? Ultimate Guide on How to Use GitHub in 2024

GitHub recently reached a milestone of 100 million users. As a developer in 2024, knowing how to use GitHub and Git commands is almost non-negotiable. In this article, you’ll learn what GitHub is, why it’s so darn popular, and how to work on GitHub.

In this ultimate guide, we'll use a series of mini GitHub how-to guides to help you learn to use GitHub like a pro! So whether you’re a beginner asking the question, “how do I use GitHub?” or a seasoned developer looking for a refresher, you’re in the right place. Let’s get started!

What is GitHub?

GitHub is a cloud-based platform that offers hosting for Git repositories, allowing you to store and share projects. It was founded in 2008 and acquired by Microsoft in 2018. 

But what is GitHub used for, and how does GitHub work? Well, it provides tools for collaboration, version control, and project management.

This has made it a popular platform for professional software developers in organizations of all sizes, not to mention its usefulness for personal and open-source projects. So if you’re looking to learn Git, chances are you’ll be using GitHub!

There’s even a dedicated student developer program to help younger coders learn how to work with GitHub, which is ideal if you’re learning to program in High-school. 

Key Features of GitHub

  • Pull requests: Allows users to propose changes to a repository. Project owners can review change requests and merge them when approved.
  • Issues tracking: A built-in system for tracking bug reports and feature requests for team members.
  • Project management tools: Includes tools like labels, milestones, kanban-style project boards, and more.
  • Continuous Integration and Deployment (CI/CD): Integration with tools like CircleCI, Travis CI, and more help to automate testing and deployment.
  • Code review: Comments and annotations help with code reviews and make it easy to provide feedback on code changes.
  • Wiki pages: Allows users to easily document their code.

What Are the Benefits of Working With GitHub?

  • Ease of collaboration with features like pull requests, issues, and branches
  • Version control via a Git-based system
  • A large community of users and easy access to help and resources
  • Enhanced security features like two-factor authentication and code scanning
  • Flexible pricing model with both free and paid plans

How to Use Github: Setting up a GitHub Account

Let’s get started by answering the first question you probably have: how do you use GitHub? First things first, let’s create an account!

Learn GitHub with a Course at Udemy

Sign Up & Sign In to GitHub

If you don’t already have an account, head over to the GitHub sign-up page to create one. After creating an account, you can sign in to GitHub, with your email and password.

Create a Profile Readme

One of the first things to do after signing up is to create a profile readme for your account. 

Your profile ReadMe is like your GitHub account's “about me” page. You can follow the following tips to optimize your GitHub profile’s ReadMe.

  • Make it visually appealing with images, graphics, and icons.
  • Share your tech stack and areas of expertise.
  • Showcase your work by linking to your best projects.
  • Mention your achievements and highlight awards and recognitions.
  • Provide contact information via any of your social media accounts.
  • Preview before you publish andensure there are no errors.

Adding SSH Keys

Why do you need an SSH (Secure Shell Protocol) key? Well, this is used to authenticate your device with GitHub, allowing you to read and write data in GitHub repos from your local machine without entering your username and password every time.

Checking for Existing SSH Key

In this GitHub how-to, let’s check if you have any existing SSH keys.

Note: The commands shown below work with Mac, Linux, and Windows PowerShell

  1. Open your terminal and run the command below to list all the files in your .ssh directory.
$  ls -al ~/.ssh
  1. Check the results of the command. If you see any of the following, then you have an existing SSH key you can add to your GitHub.
  • Id_rsa.pub
  • Id_ecdsa.pub
  • id_ed25519.pub 

If you don’t see any of these three or you get an error like that shown below, then you will need to generate a new SSH key.

$  ~/.ssh doesn't exist​

 

Results show an existing SSH key to use with GitHub

Generating a New SSH Key

Follow the steps below to generate a new SSH key.

  1. Run the following command in your terminal by replacing the ‘example email’ with your GitHub email address.
$ ssh-keygen -t ed25519 -C "your_email@example.com"​

 

You should then see something similar to the image below within your terminal window. 

A terminal message asking for the location to save SSH key

  1. Add a secure passphrase, or hit enter to use the default empty value.

Adding Your SSH Key to the SSH-Agent

After you’ve created an SSH key, you need to add it to the ssh-agent. Let’s look at the steps to do this.

  1. Run the following command to start the ssh-agent in the background. You should then see something like that in the image below.
$ eval "$(ssh-agent -s)"​

 

Starting the ssh-agent in the background and receiving confirmation

  1. Run the following command to add the SSH key to the ssh-agent. 
$ ssh-add ~/.ssh/id_ed25519

Message indicating SSH id has been added successfully

Adding a New SSH Key to Your GitHub Account

Let’s now add your new SSH key to your GitHub account with the steps shown below.

  1. Copy the SSH public copy to your clipboard using either the Windows or Mac/Linux command below.

Mac/Linux Command:

$ pbcopy < ~/.ssh/id_ed25519.pub

Windows Command:

$ clip < ~/.ssh/id_ed25519.pub
  1. Log in to GitHub, click on your profile photo in the top right corner and select Settings, as shown below.

Accessing GitHub account settings

  1. After you’ve reached the settings page, look for SSH and GPG keys in the sidebar, under the menu heading Access, as shown below.

Navigating to SSH and GPG keys on GitHub

  1. You can now click the New SSH key or Add SSH key button, as shown below.

Adding a new SSH key to your GitHub account

  1. Fill out the following form fields.
  • Title: Add a descriptive title for your new SSH key, like “Personal Laptop”
  • Key type: Leave as the default unless you need to change it
  • Key: Paste the SSH public key you copied from step 1

Filling out GitHub form to add details for your new SSH key

  1. Click the Add SSH key button to complete the process.

How to Use a GitHub Repository 

A GitHub repository (repo) is a centralized location for storing, managing, and tracking changes to your projects. Think of it like a giant folder that contains other folders and files and also a history of changes.

Creating a New Repository on GitHub

  1. Log in to your GitHub account.
  2. Click on the plus +at the top right corner near your profile photo. And select New repository.

Accessing the + menu to reveal the New repository option

  1. Fill out the form with the following information, ensuring it’s tailored to your project.
  • Repository name
  • Description
  • Visibility (Choose public or private)

You can also choose to initialize your repos with the following (or add them later).

  • A ReadMe file
  • A GitIgnore file
  • A license

Add relevant details for your new repository

  1. Click the Create repository button below the form to complete the process.

An example of a newly created repository on GitHub

Uploading and Managing Files

Uploading Files to a Repository

  1. Navigate to your repo and click on the Add file button.
  2. Click on Upload files.

Clicking on Add file will toggle the Upload files button

  1. You can either drag and drop or click Choose your files to select.

You can use drag and drop or choose your files to upload

  1. After uploading your file you need to fill out the Commit changes field.

Form for adding commit message and description

  1. Click on Commit changes to complete the process.

A new file (Hackr.jpeg) has been added to the repository

Editing Files in a Repository

If you want to know how to use code from GitHub, the following steps will walk you through how to edit files in your GitHub repo.

I’ve added hello.md to the repo to demonstrate how to edit a file

  1. Click on the name of the file.
  2. Next, click on the pencil icon on the right.

Clicking on the pencil icon will enable you to edit your file

  1. Make the necessary changes.

Once you click the pencil icon, you can make the needed changes

  1. Add the commit message and click on the Commit changes button to save your changes.

Add a descriptive commit message before committing the changes

The file has been successfully edited

Deleting Files From Repository

  1. Click on the name of the file you want to delete.

In this example, I will be deleting the hello.md file

  1. Click the trash icon on the right-hand side, as shown below.

The trash icon to delete a file

  1. Click on the Commit changes button to complete the process.

Add a descriptive commit message before committing

The hello.md file is now deleted and no longer in the repository.

How to Use Branches on GitHub

A GitHub branch is a separate copy of the codebase that allows developers to make changes without affecting the main codebase. This is useful for working on new features or fixing bugs.

How to Create a New Branch on GitHub

Login to GitHub and navigate to the repo you want to work on, then follow the steps below.

  1. Click on the main branch label.
  2. Type the name of your new branch in the box that appears directly below.
  3. Click on Create-branch below the branch name box. GitHub will then switch to this new branch.

Creating a new branch called edit--readme

GitHub automatically switches from the main branch to the edit--readme branch

  1. Make the necessary changes and click Commit changes to save. 

Making changes to the new branch and committing

GitHub prompts you to make a pull request after committing changes

How to Create a Pull Request (PR) On GitHub

A pull request lets you propose changes to a repository and is useful when you want to merge changes from one branch to another. 

Let’s now create a pull request to merge the changes from the edit-readme branch into the main branch.

  1. Click on the Compare & pull request button.
  2. Add a title and description for your PR and click on the Create pull request button, as shown below.

Adding a PR title and description

  1. If you are working in a team you’d usually wait for a team member to review your code. If your changes are approved they can be merged into the main branch. 

Merging changes to the main branches after they’ve been approved

How to Merge a Pull Request

  1. Click on the Merge pull request button to add changes to the main branch.

Message indicates no conflict with the base branch

  1. Add a merge title and description, then click the Confirm merge button.

Adding a merge title and description

Message confirms that the merge was successful

Collaborating With Others on GitHub

GitHub offers various tools for collaborating with other developers, including:

  • Issues for tracking bugs, features, and tasks
  • Project Boards for visually organizing and prioritizing issues and pull requests
  • Collaborator Access for letting contributors access a repo
  • Mentions for notifying contributors of issues, pull requests, and comments

Creating a New Project on GitHub

GitHub projects allow you to organize work by creating a visual board to add and move cards that represent tasks or issues.

Let’s take a look at how you can create a new project on GitHub.

  1. Navigate to your repository and click “Projects” on the menu, as shown below.

Accessing my projects to create a new project in GitHub

  1. Click the Link a project button on the right and select New project from the drop-down menu, as shown below.

Linking to a new project rather than linking to an existing project

  1. Now click on the New project button, as shown below.

Completing the step to link to a new project in GitHib

  1. Select a display type from the menu on the left, then add the project name and click the Create button on the bottom right, as shown below.

Finalizing the creation of My New Project in GitHub

  1. Your new project is now created and you have various options to view it. I have chosen the Board view, as shown below.

Looking at my fully created (and empty) project in Board view on GitHub

Creating An Issue for a GitHub Project

GitHub Issues let you track and manage bugs, feature requests, and other tasks or ideas related to a project.

Let’s take a look at the steps below to create an issue.

  1. Navigate to your repository and click on Issues in the menu, as shown below.

Beginning the process of creating a new Issue in GitHub

  1. Click the New issue button on the right, as shown below.

Accessing a form to add the relevant details for your issue in GitHub

  1. Add a title and description for your issue. Then, with the menu on the right, click on Projects, as shown below. Select your desired project, and then add the issue by clicking on the green Submit new issue button, as shown below.

  1. You have successfully created a new issue and added it to your project, as shown below.

Confirmation that I have added a new Issue to my GitHub project

When you navigate to your project, you will see the issue is added under the No Status column, as shown below. You can manage the issue and update its progress by dragging it to any of the other columns.

An example project board that has a new Issue 

Using GitHub for Version Control

GitHub lets you view the history of commits to a repo, as well as the changes made at each stage of the repo’s history. Let’s take a look at how to view the commit history.

  1. Log in to GitHub and navigate to the repository.
  2. Click on Commits on the right-hand side, as shown below.

Accessing the commit history of your repository on GitHub

Commit history for a GitHub repository

  1. Click on any commit to view the changes made to the repo at that point. You can then use the GitHub diff feature to locate changes, with red indicating deleted lines and green showing new lines. 

Using the GitHub diff feature to examine changes

Reverting a Pull Request in GitHub

If you want to revert changes from a pull request you have already merged, you can use the revert feature in GitHub. Let’s take a look at how to revert a pull request.

  1. Navigate to your project’s repository and click on Pull requests in the menu, as shown below.

Accessing a list of open and closed pull requests in GitHub

  1. Click Closed to see all merged pull requests, as shown below.

Displaying all of the merged PRs in GitHub

  1. Select the pull request you want to revert, as shown below.

Selecting a pull request that I plan to revert

  1. Click on the “Revert” button, as shown below.

Clicking the revert button will open a form to create a new pull request

  1. Continue by creating a new pull request. Be sure to add a title and description, then click the Create pull request button, as shown below.

Creating a new pull request to revert my original PR

  1. Click the Merge pull request button to complete the process, as shown below.

Merging the new pull request to revert the original PR

Confirmation message to indicate that the PR has been merged and closed

Other Ways to Use Git: Git Clients

Git clients can be useful to work with as they offer a graphical user interface (GUI) or command-line interface (CLI) to work with Git repos. GUI-based clients are especially useful for a visual representation of a repo’s history. 

If you want to use a Git client, you can perform all of the usual Git tasks, like cloning repos, making commits, along with pushing and pulling changes. Some of the best Git clients are GitKraken, Sourcetree, TortoiseGit, SmartGit, and Tower.

Conclusion

GitHub is a powerful platform for version control and collaboration. It allows developers to store and manage their code, track changes, and collaborate effectively with others.

With features like pull requests, issues tracking, and project boards, GitHub offers a complete solution for software engineering teams to work together effectively.

Learning how to use GitHub can help professionals (especially newcomers) improve their collaboration and development skills. And with a large community of users and many helpful resources, there has never been a better time to start using GitHub.

Are you new to software development? Check out:

How To Learn Programming

Frequently Asked Questions

1. What Is GitHub?

GitHub is a cloud-based platform that allows users to store and manage their projects in repositories and track changes to those repositories. Software developers widely use it for work and personal projects.

2. How Do I Create a Repository on GitHub?

Log in to GitHub. Click on the plus + icon in the top right corner, add a name, description, and other relevant details, and click the Create repositorybutton. Check out our detailed how-to section for more information.

3. How Do I Upload Files to a GitHub Repository?

Log in to GitHub, navigate to the repository where you want to upload files, click on the Add filebutton, then click Upload files. Check out our detailed how-to section for more information.

4. How Do I Collaborate on a GitHub Repository?

GitHub offers a range of features for collaboration. These include pull requests, issues, project boards, branches, and more. Check out our detailed how-to section for more information.

5. How Do I Resolve Conflicts on a GitHub Repository?

First, identify what the conflict is and which files contain the issue. Then decide which part of the code to keep and which part to discard. Check out GitHub’s article on resolving conflict if you want to learn more.

6. How Do I Use GitHub for Version Control?

GitHub has several version control tools you can take advantage of, including branches, commits, and diff. Check out our detailed how-to section for more information.

By Benjamin Semah

Benjamin is a software developer and technical writer for Hackr.io. He is adept at working with the JavaScript MERN stack (MongoDB, Express, React, Node.js), as well as with TypeScript, Ruby, and Rails. As a self-taught developer, he loves learning about new technologies and sharing what he learns through writing. His writings have been featured on platforms like freeCodeCamp and Scrimba.

View all post by the author

Subscribe to our Newsletter for Articles, News, & Jobs.

I accept the Terms and Conditions.

Disclosure: Hackr.io is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.

In this article

Learn More

Please login to leave comments