GIT repositories: Cloning a GIT repository

 

GIT repositories can be created by cloning the remote ones.

 

To clone a GIT repository, follow these steps.

 

Step 0

Copy the URL to the remote repository you want to clone:

 

 

Step 1

Open the GIT perspective as described here.

 

 

Step 2

Press the Clone a GIT repository button of the GIT repository toolbar:

 

 

Step 3

Paste the copied URL to the URL field in the opened window:

 

 

Step 4

The pasted URL will be split to fill in the other fields including the host, the repository path, the repository user and password:

 

 

Keep in mind that if you choose not to store user names and passwords in secure store, you'll have to type them in every time you will clone or push to the remote repository.

 

 

In the Source GIT Repository dialog,

  • URI gets the complete URL of the remote repository or the path on a local system,

  • Host gets the name of the remote host (and remains empty is you clone from the file system),

  • Repository path gets the path to the remote repository or on the file system,

  • Protocol specifies the protocol to be used ,

  • Port number specifies the number of the port to be used,

  • User and Password hold the user name and password used for authentication.

 

The following protocols are supported:

  • file - file system access to the repository,

  • ftp - File Transfer Protocol,

  • git - built-in git protocol (default port 9418)- this protocol doesn't provide authentication and is typically used for anonymous read access to the repository,

  • http - Hypertext Transfer Protocol which can be tunneled through fire walls,

  • https - Hypertext Transfer Protocol Secure which can be tunneled through fire walls,

  • sftp - SSH File Transfer Protocol,

  • ssh - Git over secure shell (SSH) protocol typically used for authenticated write access to the repository,

 

Step 5

Select the branches you want to clone from the remote repository (you can choose one, some, or all of the available branches):

 

 

You can filter the branches by typing their name:

 

 

Step 6

Specify where you want to store the cloned repository on your local system and configure this storage location (see details below):

 

 

Step 7

When you press Finish, the remote GIT repository is cloned:

 

 

and added to your GIT repositories view:

 

 

 

At Step 6, you have to configure the storage locations of the cloned repository:

 

 

A. Specify the storage location:

 

 

Directory is the folder which will hold the GIT repository. You can choose any folder which suits your development needs. If there is no folder with the specified name on your local system, the wizard will create it.

You can specify the necessary directory by direct typing or browsing.

 

Initial branch is the local branch which is initially checked out.

 

You can configure the default path for storing cloned GIT repositories from Window Preferences  Team GIT:

 

 

If you check Clone submodules when cloning a remote repository, you allow the Clone wizard to clone all the submodules of the clone repository.

Submodules are repositories which are nested inside a parent repository. If you leave Clone submodules unchecked when cloning, you won't have access to all the files and folders of the parent repository's working directory.

 

B. Specify the remote name:

 

 

Remote name specifies the alias on your system for a particular remote repository. By default, it is origin. However, you can use other names (e.g. when you work with different remote repositories).

 

C. Organize the projects:

 

 

In Projects, you can tell the Clone wizard whether and where the existing projects must be imported after the remote repository is cloned.

When adding the imported projects to a working set, you can select the necessary set among the available one from the drop-down list or in the Select Working Sets dialog:

 

 

The Select Working Sets dialog can be also used to create a new working set:

 

 

 

 

 

Related articles:

GIT Repositories view

Creating Local Repositories