SSH vs HTTPS for Git Remotes — Which Should You Use?
Git repositories can be accessed over SSH (using key-based authentication) or HTTPS (using a username/password or personal access token).
Published September 29, 2026
Git repositories can be accessed over SSH (using key-based authentication) or HTTPS (using a username/password or personal access token).
Key points
- SSH uses a key pair set up once on your machine, after which pushes and pulls need no further authentication prompts
- HTTPS works from any network without special firewall configuration, but typically requires a personal access token instead of a password on most hosts today
- Switch a repository's remote protocol at any time with git remote set-url origin <new-url>
Example
git remote set-url origin git@github.com:user/repo.git