Create new repo using git

Here are the steps to create a new repository using Git:

Step 1: Install Git

If you haven't already, install Git on your computer. You can download it from the official Git website: https://git-scm.com/downloads

Step 2: Create a new directory

Create a new directory on your computer where you want to store your repository. For example, you can create a new directory called "my-new-repo" on your desktop.

Step 3: Initialize the repository

Open a terminal or command prompt and navigate to the new directory you created. Initialize the repository by running the following command:

git init

This will create a new Git repository in the directory.

Step 4: Create a new file

Create a new file in the repository directory. For example, you can create a new file called "README.md" with some basic information about your project.

Step 5: Add the file to the repository

Add the new file to the repository by running the following command:

git add README.md

This will stage the file for commit.

Step 6: Commit the file

Commit the file by running the following command:

git commit -m "Initial commit"

This will create a new commit with the message "Initial commit".

Step 7: Verify the repository

Verify that the repository has been created by running the following command:

git status

This should show you the status of the repository, including the new file and commit.

Step 8: Push the repository to a remote location (optional)

If you want to share your repository with others or store it online, you can push it to a remote location such as GitHub or GitLab. To do this, you'll need to create an account on one of these platforms and then run the following command:

git remote add origin <repository-url>
git push -u origin master

Replace <repository-url> with the URL of your remote repository.

That's it! You've now created a new Git repository and committed your first file.