Skip to main content
Notifications
FREEBeginnerModule 1 Β· Lesson 3

Your first repository and commit

Next lesson 0 of 5 lessons done

What you will learn

Create a repository on GitHub, add a README and save your first commit.

Before you start

You need a GitHub account. A basic idea of how Git works helps, and if you plan to work from your own computer later, make sure Git is installed. For this lesson you only need a browser, because we will create everything on github.com.

Step 1: Start a new repository

Sign in to GitHub and click the plus icon in the top right corner. Choose New repository from the menu. This opens the form where you describe your project.

Step 2: Name it and choose who can see it

Give the repository a short name that describes the project, for example Git-Demo. Then decide whether it is public or private. A public repository can be viewed by anyone, which suits portfolio projects and open source work. A private one is hidden until you invite people, and the owner must grant access to each collaborator. For this lesson, pick public.

Step 3: Add a README

Tick the box that adds a README file. GitHub will create a file named README.md for you. This file is the front page of your repository. It is the first thing a visitor reads, so it should say what the project is and who made it.

Click Create repository at the bottom. You now have a repository with one commit, the one GitHub made for the README.

Step 4: Edit the README and commit

Open README.md and click the pencil icon to edit it. README files use Markdown, a simple way to format text. A line that starts with a hash sign becomes a heading, and two hash signs make a smaller heading. For example you could write a title, then a heading with your name, then a sentence about what the repository contains.

When you are happy with the text, click Commit changes. GitHub asks for a commit message. This is a short note that explains what you changed, such as Add my name to the README. Good messages make your history easy to read later. Confirm the commit and GitHub saves it.

What just happened

You created a repository, and every edit you commit becomes a step in its history. Open the commits view and you will see both commits, who made them and when. That list is exactly what Git records on your own computer too.

Other ways to do the same thing

You can also create a repository from the command line using git init, git add, git commit and git push. That route is covered in the written guide linked below this video, and it is worth learning once you are comfortable with the browser version.

Check your understanding

Try adding a second file to your repository, for example a small text file with a to-do list, and commit it with a clear message. Then look at the history and find your commits. If you can read the list and explain each entry, you have understood the core idea of version control.

Resources