How to clone a repository with SSH in Git

Cloning Git repositories with SSH provides secure authentication and encrypted data transfer without requiring password input for each operation. As the creator of CoreUI, a widely used open-source UI library, I’ve set up SSH authentication for thousands of developers across our open-source and enterprise projects. From my expertise, the most effective approach is using SSH keys with git clone for secure and convenient repository access. This method eliminates password prompts while providing stronger security through public-key cryptography for all Git operations.

Use git clone with SSH URL format to clone repositories using SSH key authentication.

# Clone repository using SSH URL
git clone [email protected]:username/repository-name.git

# Clone to specific directory
git clone [email protected]:username/repository-name.git my-project

# Clone specific branch with SSH
git clone -b develop [email protected]:username/repository-name.git

# Verify SSH connection (optional)
ssh -T [email protected]

# Expected output: "Hi username! You've successfully authenticated"

SSH URLs use the format git@hostname:username/repository.git instead of HTTPS. Ensure your SSH key is added to your Git hosting service and ssh-agent is running. The SSH protocol encrypts all data transfer and uses your configured SSH keys for authentication without password prompts.

Best Practice Note:

This is the same SSH authentication approach we use for CoreUI repository access in enterprise environments. Generate SSH keys with ssh-keygen -t ed25519 -C "[email protected]" and add the public key to your Git hosting service for secure, password-free authentication.


Speed up your responsive apps and websites with fully-featured, ready-to-use open-source admin panel templates—free to use and built for efficiency.


About the Author

Subscribe to our newsletter
Get early information about new products, product updates and blog posts.
How to round a number to two decimal places in JavaScript
How to round a number to two decimal places in JavaScript

Passing props to child components in React function components
Passing props to child components in React function components

What is globalThis in JavaScript?
What is globalThis in JavaScript?

How to limit items in a .map loop in JavaScript
How to limit items in a .map loop in JavaScript

Answers by CoreUI Core Team