Create new repository git cmd
To create a new repository in Git, you can use the following command:
git init
This command will create a new Git repository in the current directory.
If you want to create a new repository in a specific directory, you can navigate to that directory and then run the command:
cd /path/to/directory
git init
This will create a new Git repository in the specified directory.
Alternatively, you can also use the following command to create a new repository and add an initial commit:
git init && git add. && git commit -m "Initial commit"
This command will create a new Git repository, add all files in the current directory to the staging area, and then commit them with a message "Initial commit".
Note: The .
in the git add.
command refers to the current directory and all its contents. If you want to add specific files or directories, you can specify their paths instead. For example:
git add file1.txt file2.txt directory/
This will add the files file1.txt
and file2.txt
and the directory directory/
to the staging area.