If you clone an already existing project, then git is already there and everything below is irrelevant. If the project is new, you will need to enter just one command.
In order to add git to a new project you need to initialize the creation of a new git repository in its folder. To do this, go to the project folder using the terminal and enter:
git init
As a result, a git folder will appear in the project folder - .git in which your further changes will be saved every time you do git commit. Also, a .gitignore file will be created in which you specify all the files or folders that you do not want to track using git.
Next we do
git add .
to add all project files to the stage, and then
git commit -m "..."
to save all changes in the local repository that we just created. Now everything is ready and you can push the commit to git, i.e. send it for storage to the server.