Summary - Cloning
- Git course
- Beginner
- Lesson 72/80
- 5 min
Combine the clone flow to set up a local copy.
Combine the Cloning Workflow
You use git clone to download a project from GitHub to your computer. You can specify the source address using HTTPS or a previously configured SSH connection.
git clone https://github.com/ayse/uygulama.gitGit creates the local repository directory, registers the source connection as origin, and checks out the default branch. The commit history is also included in the cloned repository.
Practice Clone a GitHub Project Locally
Clone the project at https://github.com/ayse/not-defteri.git. Then display the automatically created origin connection using git remote -v and list the local branches using git branch.
Starter code
# Projeyi klonla
# Uzak bağlantıyı görüntüle
# Yerel dalları listeleSample solution
git clone https://github.com/ayse/not-defteri.git
git remote -v
git branchExpected output
Cloning into 'not-defteri'... origin git branch
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which address should a developer use to clone over SSH on a computer where SSH keys are already configured?
- https://github.com/ayse/app.git
- ftp://github.com/ayse/app.git
- git@github.com:ayse/app.git Correct answer
- http://github.com/ayse/app.git
Explanation: GitHub SSH addresses commonly use the format <code>git@github.com:user/repository.git</code>. You can connect using this address when SSH keys are configured.
2 Build the Clone Command
git clone https://github.com/ayse/____.git
git clone https://github.com/ayse/uygulama.git
Explanation: The repository URL must be complete in the <code>git clone</code> command. In this example, the repository is named <code>uygulama</code>, so the address is completed with that name.
3 Cloning Summary
| Term | Meaning |
|---|---|
git clone |
Creates a local repository copy |
HTTPS |
Address beginning with https:// |
SSH |
Authenticates with a key |
origin |
Name of the cloned source |