Get remote repository Git

Ray picture Ray · Sep 18, 2013 · Viewed 32.8k times · Source

I am almost newby in Git and just read Git book from the official site. I try understand difference between next cases.

git init Project
git remote add Project [some-url]

and

git clone [some-url]

And what is a preferable approach?

Answer

abhshkdz picture abhshkdz · Sep 18, 2013

There is no question of preference. These are commands for 2 entirely different purposes.

git init Project
git remote add Project [some-url]

git init initializes a directory as a Git repository

This is used when you are starting work on a new project, not continuing work on an existing project under version control.

git clone [some-url]

git clone copies a git repository so you can add to it

This would clone an existing repository off the remote to your machine, so that you can work on it.

Links to help you out:
* git init
* git clone