Creating a Repository
Now that Git is installed and configured, let’s create our first Git repository. A repository (or "repo") is a folder where Git tracks all changes. It’s like a special folder that remembers everything.
Step 1: Create a Project Folder
Open your terminal and create a new folder for your project. You can name it anything, for example
my-first-project:mkdir my-first-project
cd my-first-projectStep 2: Initialize Git Repository
Inside the folder, run:
git initYou’ll see a message: Initialized empty Git repository in ....This creates a hidden folder
.git inside your project. Never delete or mess with that folder! It contains all the version history.What Just Happened?
The
git init command turns your ordinary folder into a Git repository. Git starts watching for changes inside that folder and its subfolders. The .git folder is the brain of the repository.Check That It Worked
You can run
git status to see the current state:git statusIt should say: On branch main (or master) and No commits yet. This means Git is ready to track files.Creating a Repository Without a Folder
If you already have an existing project folder, you can simply navigate into it and run
git init. You don’t need to start from an empty folder.Two Minute Drill
- Create a new folder and navigate into it.
- Run
git initto initialize a Git repository. - A hidden
.gitfolder is created – this is where Git stores history. - Use
git statusto check the repository state.
Need more clarification?
Drop us an email at career@quipoinfotech.com
