Git set up

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-repo

If 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

  1. git init my-repo
  2. cd my-repo
  3. add something to my-repo
  4. git remote add origin
  5. git add .
  6. git commit -m “First commit”
  7. 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.

Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!


Leave a Reply

Your email address will not be published. Required fields are marked *