Git repository clone new or add to existing local project

GIT is an amazing code versioning tool. Well if you are new to GIT and wondering how to clone GIT repo locally to new folder or to the exising code folder.
Humm… Here are two methods, use according to your need.

Method1: Existing project

  • Step 1: Switch to your repository’s directory
    • cd /path/to/your/repo
  • Step 2: Connect your existing repository to Bitbucket
    • git remote add origin
    • git push -u origin master

Method2: Starting from scratch

  • git
  • cd testecho "# My project's README" >>
  • git add
  • git commit -m "Initial commit"
  • git push -u origin master

Thats it and you are good to go.

Author: Danyal
I'm working as programmer since 2002. Born, grew up, studied and worked in Pakistan now Im located in Denmark since 2006.