Git & GitHub Interview Question #144
What is the difference between HTTPS and SSH authentication for GitHub?
Security, Team Workflows, Troubleshooting & Senior Git/GitHub Scenarios Senior Advanced
Quick Interview Answer
HTTPS and SSH are two common transport and authentication approaches for GitHub Git operations. HTTPS typically authenticates using supported credentials or credential-manager flows, while SSH uses a public/private key pair configured for the account.
Detailed Explanation
HTTPS and SSH are two common transport and authentication approaches for GitHub Git operations. HTTPS typically authenticates using supported credentials or credential-manager flows, while SSH uses a public/private key pair configured for the account.
Both can be secure when configured correctly. Teams may prefer one based on enterprise policy, credential management, developer environment, or automation requirements.
Code Example
# HTTPS remote
git remote set-url origin https://github.com/username/project.git
# SSH remote
git remote set-url origin git@github.com:username/project.git