Git - Clone


git clone creates a local repository from remote repository you’d like to contribute to.

cloning in git means:

The command is “clone” and not “checkout” ( instead of getting just a working copy, Git receives a full copy of nearly all data that the server has.)

After a first clone of a repository, all files will be tracked and unmodified because they are just checked out and they haven’t been edited.

If you just want to download, see the download page


Clone an existing Git repository from another server.

git clone [option] [url] [directory]

We can also use the following protocol in place of https:

  • git://
  • ssh with [email protected]:path/to/repo.git
  • –depth 1 grabs the current file state and no history (handy for a build)


Git’s clone command automatically:

  • create the origin name,
  • creates a pointer to where its master branch is,
  • names it origin/master locally.
  • create a local master branch starting at the same place as origin’s master branch (where you will work to)


  • creates a directory named “directoryWhereIwantMyCheckoutData” (The default name is the name of the git file in the URL) ,
  • get the clone URL from the Web
git clone directoryWhereIwantMyCheckoutData
Cloning into 'directoryWhereIwantMyCheckoutData'...
remote: Counting objects: 77, done.
remote: Total 77 (delta 0), reused 0 (delta 0), pack-reused 77
Unpacking objects: 100% (77/77), done.
Checking connectivity... done.

It will:

  • initializes a .git directory inside it,
  • pulls down all the data for that repository,
  • and checks out a working copy of the latest version.

How to

How to clone if the directory is not empty

with init and pull

git init
git pull https://.....git "branch"

How to clone and checkout a branch

git clone --depth=50 --branch=stable https://.....git .

Documentation / Reference

Powered by ComboStrap