Before running the Git command to create the repository, we need to make sure that we’re in the right directory. In this article we will follow the process on MAC Operating System but it is similar in Windows and Linux.
FOR MAC & LINUX
Open the Terminal app which can be found in Applications > Utilities.
Open the Command Prompt from Start > Windows System, or by pressing Windows + R then typing
cmd and clicking OK.
If you have created a folder for your project called
laravel-demo in a
WebProjects folder in your home directory, you’ll need to run the following command:
Once you’re in the correct directory, enter
git init in your command line and press enter to create a new empty Git repository. If successful, you should see a message like this:
Initialized empty Git repository in /Users/bhavik/WebProjects/laravel-demo/.git/
A hidden folder named
.git will have just been created inside your project’s working directory. This folder is your local copy of the repository information which contains all the information Git stores about your repository including historical changes, remote repository addresses, and more.
.git folder won’t delete any of the files in your project, however you’ll lose access to all of the historical changes tracked by Git.