Difference between git remote add and git clone

What does the clone command do? Is there any equivalent to it in svn?

What's 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?

+51
git git-remote git-clone
Jan 31 '11 at 20:10
source share
3 answers

git remote add simply creates an entry in your git configuration that specifies a name for a specific url. To do this, you need to have an existing git repository.

git clone creates a new git repository by copying the existing one specified in the specified URI.

+49
Jan 31 '11 at 20:13
source share

They are functionally similar (try!):

  # git clone REMOTEURL foo

and

  # mkdir foo
  # cd foo
  # git init
  # git remote add origin REMOTEURL
  # git pull origin master

Now there are minor differences, but in principle, you probably won't notice them. As an exercise left to the reader, compare .git / config from each directory.

+37
Jan 31 '11 at 21:11
source share

The clone command creates a local copy of the repo you specify. remote add adds a remote repo, which you can either click or extract from it.

The svn equivalent of clone is equal to checkout .

+5
Jan 31 '11 at 20:12
source share



All Articles