Difference between git remote add and git clone
What does the clone
command do? Is there any equivalent to it in svn?
What is the difference between
git remote add test git://github.com/user/test.git
And
git clone git://github.com/user/test.git
Does the name of the created repo matter?
Solution 1:
git remote add
just creates an entry in your git config that specifies a name for a particular URL. You must have an existing git repo to use this.
git clone
creates a new git repository by copying an existing one located at the URI you specify.
Solution 2:
These are functionally similar (try it!):
# git clone REMOTEURL foo
and:
# mkdir foo # cd foo # git init # git remote add origin REMOTEURL # git pull origin master # cd ..
Now there are minor differences, but fundamentally you probably won't notice them. As an exercise left to the reader, compare the .git/config's from each directory.
Solution 3:
The clone
command creates a local copy of the repo you specified. remote add
adds a remote repo that you can either push to or pull from.
The svn equivalent of clone
is checkout
.