The git init command is used to create a git repository. The git init creates a .git subdirectory which contains the git metadata for the repository. Keep in mind that the current directory in which you run the git init command will be the repository.
// make the current direct a repository
git init// create a new repository in a new directory
git init directory-name
// example
git init test-repoIf your run git init again in a repository it will not overide the existing configurations.
How to create a new local repository and push it to remote
- git init my-repo
- cd my-repo
- add something to my-repo
- git remote add origin https://github.com/repo-location.git
- git add .
- git commit -m “First commit”
- git push origin master
*** All though this works, it is better to create a remote repository and then clone it to your computer or server.