Introduction to GitHub: Part 1

What’s GitHub?

GitHub is a cloud-based platform where developers can store, update, and track their code.

What’s a Repository?

GitHub repository is the place where a project’s files are stored.

Create a Repository

Once you’ve signed up for GitHub, you can create a repository.

Step 1: Click Create repository.

Step 2: On the Create a new repository page, enter repository name and description.

Step 3: Choose whether the repository should be public or private. For this example, we’ll keep the repository as private.

Step 4: Select Add a Readme File. Leave the remaining options at their default settings.

Step 5: Click Create repository on the Create a new repository page.
You’ll be automatically directed to the repository’s home page. The Readme contains the name and description of the repository.

Make your First Commit

A commit indicates the changes made to a file. Let’s make changes to the Readme.

Step 1: Click the pencil icon for the Readme.

Step 2: Edit the Readme. I added my name and location.

Step 3: Click Commit changes.

Step 4: When you click the Commit changes button, a dialog box appears. Describe the change you made to the file in the Commit message field. I entered Updated README here.

You can create branches of the main branch. For now, we’ll commit to the main branch. Each commit is like a version of the file.

Click Commit changes in this dialog box.

After committing the changes, you’ll see that the Readme file now includes the text we added. Plus, the commit message we entered is displayed.

To the right of the file, you can see when the file was last updated and find the History button. This allows you to easily check the file’s revision history.

Clone a Repository

We used the GitHub website to create a repository and commit changes to a file within it. Now, let’s get familiar with GitHub Desktop. Download GitHub Desktop (https://desktop.github.com/download/) and install it.

After installing GitHub Desktop, we’ll use it to clone the repository. Cloning means downloading the repository to your local machine, allowing you to make changes locally and then upload those changes to the remote repository on GitHub.com. Here’s how to clone the repository:

Step 1: On GitHub.com, go to the main page of the mygithub-demo repository.

Step 2: Click Code and under HTTPS, click Open with GitHub Desktop.

Step 3: GitHub Desktop opens with a dialog box. Click Choose to set a local folder where you want to clone the repository. Then, click Clone.

Once the cloning process is complete, GitHub Desktop will display the repository name in the list on the top left side of the window.

To view the repository files in your local file system, click Show in Explorer located on the right-hand side of the window. To see the remote repository on GitHub.com, click View on GitHub.

Congratulations on completing the first part of our Introduction to GitHub tutorial! You’ve learned the basics of GitHub, including what it is, what a repository is, how to create one, and how to commit your first changes. You also got hands-on with GitHub Desktop and cloned your repository to your local machine.