๐Ÿ‡ฏ๐Ÿ‡ต ๆ—ฅๆœฌ่ชž | ๐Ÿ‡บ๐Ÿ‡ธ English | ๐Ÿ‡ช๐Ÿ‡ธ Espaรฑol | ๐Ÿ‡ต๐Ÿ‡น Portuguรชs | ๐Ÿ‡น๐Ÿ‡ญ เน„เธ—เธข | ๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡

Creating Your First Repository on GitHub! A Complete Guide from Init to Push

In the previous articles, you created a GitHub account and installed Git, getting you all set to start using GitHub in earnest. As a first step, let's create a "home" to store your codeโ€”a repository.

This article will carefully explain the entire process, from the basic concept of "What is a repository?" to the specific steps for creating a repository on GitHub, and finally, uploading (pushing) a file from your computer (local environment) to GitHub for the first time, complete with commands. This workflow is a fundamental action you'll repeat many times in your future development, so let's master it here!


What is a Repository, Anyway? It's a "Container" for Your Project

A Repository literally means a "storage place" or "depository." In the world of programming, you can think of it as a "container" that holds all the files related to your project (HTML, CSS, JavaScript, images, etc.) along with their entire history of changes (commit log).

There are two main types of repositories:

The basic development flow is a cycle of working in your local repository, saving your progress at a good point (a commit), and then uploading those changes to the remote repository (a push).


Steps to Create a Remote Repository on GitHub

First, let's create a remote repository on GitHub to be the storage place for your code. The steps are very simple.

Step 1: Navigate to the New Repository Page
Log in to GitHub and click the "+" icon in the top right corner, or press the "New" button on the left side of your dashboard.

[Image: The "New" button on the GitHub dashboard is highlighted.]

Step 2: Fill in the Repository Information
You'll be taken to a page titled "Create a new repository." Fill in the necessary information here.

[Image: The "Create a new repository" form with explanations for each field.]

Step 3: Create the repository
Once you've filled everything out, click the "Create repository" button. With that, your new remote repository has been created on GitHub!

[Image: The main page of a newly created, empty repository.]


Preparing a Project on Your Local PC and Connecting to GitHub

Next, let's prepare a project on your PC (local) and upload your first file to the remote repository you just created.

Step 1: Create a project folder on your PC
First, create a working folder somewhere on your computer. We'll use the terminal (or Git Bash on Windows) for this.

mkdir my-first-repo

Move into the folder you just created.

cd my-first-repo

Step 2: Initialize a Git repository
To place this folder under Git's management, run the initialization command. This will create a hidden `.git` folder within this folder.

git init

Step 3: Create a file to upload
Let's create a simple HTML file for testing.

echo "Hello, GitHub!" > index.html

Step 4: Commit the file (Save it)
Record the created file in Git. First, use `git add` to select the file for saving (staging).

git add index.html

Next, create a save point with `git commit`.

git commit -m "Add initial HTML file"

Step 5: Connect to the remote repository
Link your local repository with the remote repository you created on GitHub earlier. Go to your repository page on GitHub, click the "Code" button, and copy the SSH URL.

[Image: Clicking the "Code" button on GitHub and copying the SSH URL.]

git remote add origin git@github.com:your-username/my-first-repo.git

Step 6: Push to GitHub (Upload)
This is the final step. Upload the commit you created locally to the remote repository. This is called a "push".

git push -u origin main

Verification: Let's See if the File is on GitHub

Once the push is complete, try reloading your repository page on GitHub in your browser. You should now see the `index.html` file you just created! You can click on the filename to see its contents.

[Image: The GitHub repository page showing the newly added index.html in the file list.]

Congratulations! You have now mastered the most basic and important workflow: uploading a local file to GitHub.