Interview Questions

1

Below is a clear, technical explanation of the differences between:

git clone git@github.com:kactlabs/wiki.git 2. git clone https://github.com/kactlabs/wiki


1. Protocol Used

Command
Protocol
Description

git@github.com:kactlabs/wiki.git

SSH

Uses SSH keys for authentication

HTTPS

Uses HTTPS with username/password/token


2. Authentication Flow

SSH (git@...)

HTTPS (https://...)

Credential type

SSH private key

GitHub username + Personal Access Token

Prompt for password?

No (if key is configured)

Yes (unless credential manager stores token)

Security

Strong (key based, can be password protected)

Depends on how token is stored

Ideal for

Frequent contributors

Quick clone, CI pipelines


3. Permissions

Scenario
SSH
HTTPS

Read public repo

Yes

Yes

Push to repo

Yes (if key authorized)

Yes (requires PAT with repo scope)

If the repo is private or push access is required, SSH is generally preferred.


4. Use in CI/CD and Servers

  • SSH works well on development machines where you have private keys.

  • HTTPS works better for automated environments using tokens (GitHub Actions / CI runners).


5. URL Format Differences

Git treats them slightly differently:

SSH: git@github.com:org/repo.git No protocol prefix; host + path is embedded in SSH syntax.

HTTPS: https://github.com/org/repo Standard web URL syntax.


Which One Should You Use?

Use Case
Recommended

You want to push changes regularly

SSH

Using GitHub Desktop or browser clones

HTTPS

Working behind firewalls blocking SSH (port 22)

HTTPS

CI using tokens

HTTPS

Secure individual developer environment

SSH


Summary

  • SSH clone: Secure, no password prompts, best for contributors with push access.

  • HTTPS clone: Simpler, uses tokens/password, works everywhere, good for read-only or automation.


2

Last updated