Creating Your First Repository on GitHub

In this section, you’ll get a general overview of github.com, set up a new, free-tier account, and make your first repository. Don’t worry if you use another service like Azure, Bitbucket, or GitLab in your work, as many of the features are similar.

Signing Up

The first thing to do, of course, is to create an account on github.com. If you’ve created an account in the past, skim along until the “Your First Repo” section.

On the homepage of https://github.com, find the “Sign up” button and click it to begin.

Home screen of github.com showing where to look for the button to sign up for a new account.
Home screen of github.com showing where to look for the button to sign up for a new account.

GitHub provides a sign-up wizard to lead you through the steps. First, you enter the email address you want to use and a password. As with any online service, make a new password; don’t reuse the one from your bank or Tinder account.

Next, GitHub asks you to create a username. Because millions of people use GitHub, you might have to get creative with the username before you find one that’s available. When collaborating with others on repositories, GitHub prefers to search and assign via usernames and real names instead of email addresses. GitHub also uses the username as part of every repository you create.

Because GitHub uses your username in the URLs of all your repositories, the characters you can use are restricted. You can use any combination of letters and numbers, and you can use hyphens. You can’t have two hyphens next to each other, nor can you begin or end with a hyphen.

After you create a unique username, GitHub asks you to opt in to its marketing emails and requires you to solve a test to prove you’re human.

Now, click “Create account”. At this point, GitHub sends a verification code to the email address you provided. Enter that code to complete creating your account.

GitHub now presents you with a personalization page. To create a free account, scroll to the bottom and click “skip personalization”. You can always learn about features like Copilot and CI later. Clicking any options on this page modifies how GitHub configures the dashboard page. Also, if you click one of the categories requiring a paid account, GitHub lets you know you’d need to upgrade to use those features.

You can create public and private repositories with the basic, free account. For either public or private repositories, you decide who can commit to the repository besides yourself. Private repositories are visible only to you and your collaborators. Public repositories are read-only for anyone on the internet.

GitHub behaves other social media platform in many ways. So, as you browse the public repositories, you might see that some people make all of their repositories public. You can always change a repository’s visibility between public and private.

Your First Repo

Your dashboard usually has two or three buttons to create new repositories.

Example dashboard showing some of the places you can find the button to create a new repo. Dashboards are personalized, so your's may not look quite like the image.
Example dashboard showing some of the places you can find the button to create a new repo. Dashboards are personalized, so your's may not look quite like the image.

Your dashboard might look different from the image above, depending on any topics you chose during personalization or if you already had an account. However, the button to the right of the search bar and the button in the left column are on most layouts. The button on the left changes its text for some layouts but is still always near the top of the pane.

Pick either button to use and click it to get to the “Create a new repository” screen. If you want to use the one that’s part of the “Start a new repository for…” form, you must supply a name. The name will be part of the URL for the repository. So, just as with your username, you’re limited to letters, numbers, and hyphens.

Unless you added one at the start, the first thing to do is enter a name for your repository. GitHub checks that it’s a unique name, but you can choose nearly anything because the name will be a combination of your username and this repository name. GitHub even offers a link to prefill a generic name.

Next, you can enter a description and choose whether you want this repository to be “Public” or “Private”.

Then, decide whether to include a README file. This is a file, usually in markdown, that appears on your repository’s homepage on GitHub. By convention, the README has a description of the repository, notes about how to use files in the repository, and any other information you think would be useful to someone just discovering the repository. The README becomes part of the repository, just like any other file, and you can update it later.

Next, you must choose a .gitignore template or leave the default of None. This lesson hasn’t covered .gitignore, but it’s basically a collection of filename and filename wildcard patterns you want to keep out of the repository but that might be in your working directory.

When your repository is for a codebase, it can be important that files with API keys or temporary build files don’t make it into the repository. Whenever you use the git status command, it consults the patterns in .gitignore and ignores any file matching the patterns so you don’t accidentally add and commit particular files. You can add a .gitignore later. There’s also a link to learn more about adding .gitignore patterns.

When you create a public repository, you need to include a license if you want to make the repository’s contents usable by others. If you don’t include a license, standard copyright laws apply. GitHub has a separate website at https://choosealicense.com to help you decide how you might like to license code you want to share. Note that private repositories don’t need a license. If you ever switch a private repository to a public one, GitHub reminds you about the license. As with .gitignore and README, the license is just another text file in your repository.

Once you complete the form, click “Create repository” to create the repository.

If you didn’t opt to include a .gitignore, README, or LICENSE, you’re presented with instructions for how to link this repository to a local repository. If you included one of those files, GitHub presents you with the main list of files for your new repository marked with “initial commit”.

Now, you have a new remote repository on GitHub! In the next section, you’ll learn how to either make this repository the remote for one on your computer or check out this repository to your computer.

See forum comments
Download course materials from Github
Previous: Why Use a Remote? Next: New Repository Demo