HTTPS vs SSH
- Git course
- Beginner
- Lesson 70/80
- 4 min
Learn the differences between HTTPS and SSH cloning.
Cloning with HTTPS
You can clone GitHub repositories using an HTTPS address. In this method, the repository address starts with https://, and when authentication is required, you use an authentication method supported by your GitHub account.
git clone https://github.com/ayse/site.gitHTTPS can be used on most computers without additional SSH key configuration. However, authentication is required when accessing private repositories.
Cloning with SSH
SSH uses an SSH key pair to establish a secure connection with GitHub. After adding your public key to your GitHub account, the private key stays on your computer and the connection is authenticated using the key pair.
git clone git@github.com:ayse/site.gitSSH addresses commonly begin with git@github.com:. When SSH keys are already configured, you do not need to enter a username and password for every connection.
Practice Clone Using an HTTPS Address
Clone the repository at https://github.com/ayse/urun-katalogu.git. Use an HTTPS connection in the command and do not change the repository address.
Starter code
# HTTPS ile depoyu indirExpected output
Cloning into 'urun-katalogu'...
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which prefix distinguishes an HTTPS address from other connection types?
- ssh://
- git://
- ftp://
- https:// Correct answer
Explanation: HTTPS addresses begin with <code>https://</code>. You can see this prefix in standard GitHub HTTPS repository URLs.
2 Complete the SSH Address
git clone ____ayse/site.git
git clone git@github.com:ayse/site.git
Explanation: GitHub's common SSH address format is <code>git@github.com:user/repository.git</code>. An HTTPS address begins with <code>https://</code>.
3 HTTPS and SSH
| Term | Meaning |
|---|---|
https:// |
HTTPS address prefix |
git@github.com: |
SSH address prefix |
Açık anahtar |
Added to the GitHub account |
Özel anahtar |
Stored on the computer |