Loading video player…

Creating Your First Git Repository

00:00 To create your first Git repository, or Git repo for short, start by opening your terminal and navigating to a folder where you’re comfortable doing some experimentations with your file system.

00:12 So you’re going to be creating and deleting files and folders here, so make sure you have a workspace that’s ready for that. And then run the commands git init first-git-repo.

00:24 So git init is the subcommand that initializes a repo, and first-git-repo is the name of that repo, which will translate in the name of the folder that gets created.

00:34 Once you press Enter, you will see a success message by Git, and then you can cd into your first-git-repo. So you can cd into the folder that gets created.

00:47 Now, what does a repo look like? In the beginning, if you just run ls -al, you will see a single subfolder called .git. And this is the subfolder that Git uses to manage your repository.

01:01 Everything that Git does goes through this folder. Feel free to inspect it if you’re curious, but don’t worry if you don’t understand what’s going on, because no one really does.

01:11 Once you create your repo and you cd into it, you might notice that on the screen there’s a visual cue that’s added to the right of the folder name.

01:22 The folder name first-git-repo is then followed by a piece of text in different colors that says git:, and then inside parentheses, the word main.

01:31 This is a visual cue that’s added by the shell being used. It’s not a Git-specific feature, it’s a shell feature that makes it easier to work with Git by giving more visual context.

01:43 As you dive into Git, if you feel the need for these extra visual cues, then you should look up how to customize your shell. This is not a Git-specific feature, it’s a shell-specific feature.

01:55 Once you’ve created your first repo, move on to the next lesson where you’ll be tracking your first files in your Git repo.

Become a Member to join the conversation.