Introduction to Version Control

Apr 10 2024 · Git 2.44, Terminal, GitHub Desktop

Lesson 03: Using GitHub for Version Control

New Repository Demo

Episode complete

Play next episode

Next
Transcript

This demo assumes you’ve successfully created your GitHub account and are logged in. Here’s the main dashboard. Start by choosing any button to create a new repository.

You can also see the Import Repository link. This would be for if you had an existing repository on another server or hosting service. It’s not for uploading a repository from your computer.

Here, at the “Create a new repository” screen, you see the “Owner” and “Repository” name fields. This is the last part of the URL path to your repository. The “Repository name” and “Description” fields hold data that get displayed on your repository’s home screen, the your profile’s home screen, and any search results that include this repository.

I’ll make one for the demo bread recipe. Because your username comes before the repository name in the URL path, your repository name only needs to be unique among all your repositories, not unique among all of GitHub. There are over 1.7 million public repositories with the title “hello-world” on GitHub, and likely just as many private ones.

After entering the name and description, you must choose whether this repository will be public or private. You can always change this later in the repository settings.

If you check the box for the “Add a README file” option, GitHub creates an empty README.md text file and makes an initial commit when creating your repository. You can use this link to learn about how GitHub uses the readme file and the kinds of information you might want to include in yours.

When you create a repository for a coding project, adding a .gitignore is a good idea. GitHub provides templates for commonly used programming languages. You can also click this link to learn how to add one later and for resources to create templates for languages that aren’t on the list. The bread repository is just markdown and images, so it doesn’t need a .gitignore file. If you choose one, it will get added to the initial commit like the readme.

Choosing a license is important if you’re creating a public repository of code you want other people to use. Because the license is a legal document that modifies your copyright claims, choosing one that matches how you’d want the code to be shared and reused by others is important. You can navigate to this “Learn more” link to reach a link to choosealicense.com. GitHub created this website to help you understand which license is appropriate for your project. You can always add a license later. If you create an empty text file in your repository called “LICENSE”, GitHub notices that file and shows you the license template wizard.

This is a private repository, so a license isn’t needed. However, if you want to see how the wizard works, choose the MIT license. It’s a general and permissive license. You can delete the license file later, and the repository reverts to being protected only by copyright law.

When you’ve completed the form, GitHub tells you where you’re creating the repository and whether it’s public or private. It’s important that GitHub tells you where you’re creating the repository. As you’re working, you may join various teams on GitHub. When you create a new repository, you can create it under your account or as part of that team. This reminds you what you’re about to do so you don’t create the repository in the wrong place.

Now, click “Create repository”. You see this screen if you didn’t opt in for a license, gitignore, or readme. If you click here in your browser’s navigation bar, you see the full URL to this repository. You also see your username and the repository’s name at the top.

Below is the button to add collaborators. Later in the lesson, you’ll learn how to do that. But when you know that you want to collaborate as you create a repository, it’s a shortcut. Then, GitHub shows you a few ways to link this repository to a local repository on your computer. You’ll learn more about these in the next section.

Here’s another repository where we added a license but not a readme. If you chose one of those options during setup, this is the screen you get. You can see the list of files and the commit message that GitHub added as the initial commit.

You can click this button to add a readme. You can click here to see and edit the license.

Click to add a readme.

You have a basic text editing window where you can write your markdown. This is the homepage of your repository on GitHub. Notice that this “Commit changes” button gets enabled as you type. Once you’re satisfied with what you have in the readme, click the button. As you saw in the last lesson, you need a commit message and an optional description. You also get the option to commit this readme directly to the main branch or to make a branch. The demo commits to the main branch.

Now, the homepage of the repo has changed. The list of files appears, and below that are the readme contents. Before ending the demo, look at the repository settings by clicking this “Settings” button.

This is where you can see the “Add collaborators” button on the left. You can also rename the repository and change some of the other general settings for the repository.

In the next section, you’ll learn how to link this remote repository to one on your local computer. You’ll also learn the commands to move changes between the local and the remote.

See forum comments
Cinema mode Download course materials from Github
Previous: Creating Your First Repository on GitHub Next: Linking a Repository to GitHub