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?
git clone [something]
is the equivalent to:
git init Project
git remote add origin [some-url]
git pull origin master
It's a little strange to call your remote Project
, but perhaps that was a typo. Either way, you can specify -o
to name the remote something else when cloning, from the man page:
Instead of using the remote name origin to keep track of the upstream repository, use .
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With