Create a new git repository using command line

Profile picture for user vinaykrr202
Submitted by vinaykrr202 on

 To create a new git repository follow below steps:

Step 1: Create a directory to contain the project.

Step 2: Go into the new directory.

Step 3: Type below command

$ git init

Step 4: Write some code or clone an existing repository using below command

$ git clone "repo url"

Step 5: Type below command to add all files

$ git add -A

or type below command to add specific files

$ git add file1 file2

Step 5: Commit code

$ git commit -m "my message"

Step 6: Push code

$ git push origin master