To create a new Git repository, follow these steps:
-
Open your terminal.
-
Navigate to the directory where you want to create the repository. For example:
cd ~/project -
Initialize a new Git repository using the
git initcommand:git init my_project -
Navigate into the new repository:
cd my_project -
Verify that the
.gitdirectory has been created:ls -aYou should see output similar to:
. .. .git
Now you have successfully created a new Git repository named my_project. You can start adding files and making commits.
