Git Concepts

Quick Start Guides

Git Clone

Git clone is used to copy an existing Git repository into a new local directory.

The Git clone action will create a new local directory for the repository, copy all the contents of the specified repository, create the remote tracked branches, and checkout an initial branch locally. By default, clone will create a reference to the remote repository called origin.

Git Clone Repository

Cloning a repo allows you to make local changes to the repository before committing and pushing them to the remote.

This can be especially beneficial for beginner developers as cloning gives you a sandbox to experiment without affecting the original codebase (and angering your team members 😅).

Remote Repository URL Protocols

The supported protocols for remote URLs in Git are SSH, Git, HTTP, and HTTPS.

Git SSH Remote Protocol

SSH stands for Secure Shell. Using Git SSH allows you to authenticate with a remote repository using a key.

Format of an SSH URL: ssh://{user}@{host}:{port}/path/to/repo.git or {user}@host:path/to/repo.git

To use Git SSH in the command line, you will need to generate a public and private SSH key, add the key to your SSH-agent, and add the public key to the remote hosting service.

Git Remote Protocol

The Git protocol is an unauthenticated method and should be used with caution.

Format of a Git URL: git://{host}:{port}/path/to/repo.git

HTTP(S) Remote Protocol

HTTP(S) stands for Hyper Text Transfer Protocol (Secure). Using HTTPS allows you to authenticate with the repository using username and password credentials.

Compared with HTTP, HTTPS is a more secure version.

Format of an HTTPS URL: https://{host}:{port}/path/to/repo.git

GitTip: Learn more about local Git repositories and remote repositories with our beginner Git tutorial video series.

We’re going to go over how to clone a Git repository using the GitKraken Git client, before showing a Git clone example using the command line.

Follow along with the upcoming examples of cloning in GitKraken and the command line using this GitHub practice repo.

Practice Cloning

How do you clone a Git repository with GitKraken?

GitKraken supports cloning over HTTPS or Git SSH.

To clone a repository in GitKraken, you can navigate to Repository Management > Clone. You may clone using a URL or one of the configured remote repo integrations, such as GitHub.

In this Git clone example, we will be showing how to clone a GitHub repository using GitKraken.

SSH Remote Protocol with GitKraken

If you are using a URL to clone over SSH with GitKraken, you will first need to configure Git SSH in the Git client. GitKraken has a built-in SSH-agent that makes working with SSH keys, including GitHub SSH keys, very easy.

Your GitKraken SSH settings can be found under Preferences > SSH. Here, you can generate a new SSH key, point to an existing key, or use your local SSH-agent to manage SSH.

If this is your first time using SSH through GitKraken, you will need to add the SSH key to the remote hosting service—in this case, GitHub. You will simply copy the public key from GitKraken, and add it under the settings section of your hosting service.

After you have completed those steps, you will be able to simply provide the SSH URL to clone remote repositories with GitKraken.

For more information on working with SSH in GitKraken, see our Git SSH documentation. GitHub also has a great guide for how to work with SSH.

HTTPS Remote Protocol with GitKraken

If you’re using a URL to clone over HTTPS with GitKraken, you simply provide the remote URL when prompted to do so.

Here, you will also set the local path to clone and the local repository directory name.

GitKraken Integrations for Cloning

Gitkraken offers integrations for the following remote repository hosting services to make cloning, as well as many other actions, even easier:

As seen below, each hosting service integration you have connected to your GitKraken account will list all of the remote repositories available to clone.

HTTPS is the default remote protocol in GitKraken. After connecting to your remote repository hosting service, you will not be required to fill out your credentials while working over HTTPS as the integration uses OAuth or a PAT (Personal Access Token) to authenticate.

For each of these integrations, you can quickly create an SSH key or point to an existing one. Generating an SSH key will automatically add it to the hosting service, removing the need to manually copy it from one platform and add it to another.

You can manage your GitKraken integrations at any time by navigating to Preferences > Integrations. In this example, you can see GitKraken is creating a GitHub SSH key.

Alternatively, if you would like to point to an existing SSH key, you can add the public SSH key to the hosting service with a single click.

Put your new skills to the test and practice cloning a repository with GitKraken and the command line using this instructional GitHub repo.

Practice Cloning

How do you clone a Git repository in the command line?

In this example, we will go over the process of cloning a GitHub repository over HTTPS. To clone a Git repository, you will first copy the remote URL from your repository hosting service—in this case GitHub.

You will then use the Git clone command followed by the remote repo’s URL.

git clone <repository-url>

If you are working with a private repository, you will be prompted for your remote hosting service credentials.

After cloning, you can change directories (cd <path>) into the repository to begin working in it. There are many additional flags that can be used while cloning for things like naming the local directory, naming the remote, or checking out a branch.

The more your Git portfolio grows, the harder it will be to manage your library of remote repos. The GitKraken Git client can help organize your remotes from multiple hosting services, giving you the ability to quickly find and clone the repo you need.

Additional Resources

Make Git Easier, Safer &
More Powerful

with GitKraken