Git and GitHub with Bash Command Line: A Beginner’s Guide

Ibrahim Jaber
4 min readApr 11

As a software developer, you may find yourself using Git and GitHub on a regular basis to manage your codebase and collaborate with others. While many developers use graphical user interfaces to interact with Git and GitHub, using the command line can be a more efficient and powerful way to work. In this blog post, we’ll explore how to use the Bash command line to interact with GitHub.

Setting Up Your Environment

Before we dive into the commands, let’s make sure we have everything set up correctly. First, make sure you have Git installed on your system. If you’re using a Unix-based operating system, it’s likely that Git is already installed. You can check by running the following command in your terminal:

git --version

If Git is not installed, you can download it from the official website:

Next, you’ll need to authenticate with GitHub so that you can access your repositories. If you haven’t already, create a GitHub account and generate an access token. You can create a token by going to your GitHub account settings, selecting “Developer settings”, then “Personal access tokens”. Make sure to give your token the necessary permissions for the tasks you want to perform.

Once you have your access token, you can set it as a global environment variable by running the following command in your terminal:

export GITHUB_TOKEN=<your_access_token>

Cloning a Repository

Let’s start by cloning a repository from GitHub to our local machine. In this example, let’s imagine we’re working on a business problem where we need to build a web app that displays a list of recommended books. We’ve found an open source repository on GitHub that has a list of book recommendations that we can use as a starting point.

To clone the repository, navigate to the directory where you want to store the code on your local machine and run the following command:

git clone<username>/<repository>.git

Replace <username> and <repository> with the username and name of the repository you want to clone. For example, if the repository is owned by a user with the username johndoe and is named book-recommendations, the command would be:

git clone…



Ibrahim Jaber

Software developer | Programming and Blockchain enthusiast