How to use SSH keys in Git
Using SSH keys for Git authentication provides secure, passwordless access to remote repositories with better security than HTTPS credentials. As the creator of CoreUI with over 25 years of development experience, I’ve configured SSH authentication for countless development teams and projects. The most effective solution is to generate an SSH key pair and add the public key to your Git hosting service. This approach eliminates password prompts while providing strong cryptographic authentication.
Generate and use SSH keys for secure Git authentication.
# Generate new SSH key
ssh-keygen -t ed25519 -C '[email protected]'
# Or use RSA if ed25519 is not supported
ssh-keygen -t rsa -b 4096 -C '[email protected]'
# Start SSH agent
eval "$(ssh-agent -s)"
# Add SSH key to agent
ssh-add ~/.ssh/id_ed25519
# Display public key to copy
cat ~/.ssh/id_ed25519.pub
# Test SSH connection to GitHub
ssh -T [email protected]
# Clone repository using SSH
git clone [email protected]:username/repository.git
# Change existing repository to use SSH
git remote set-url origin [email protected]:username/repository.git
The ssh-keygen command creates a public-private key pair. The ed25519 algorithm is modern and secure, while RSA is more compatible with older systems. The private key (id_ed25519) stays on your machine, while the public key (id_ed25519.pub) is added to your Git hosting service (GitHub, GitLab, Bitbucket). After adding your public key to the service, Git uses SSH for authentication automatically when using SSH URLs.
Best Practice Note
This is the same SSH key setup we use for CoreUI repository access across all team members. Always protect your private key with a strong passphrase and never share it. Use different SSH keys for different services or organizations for better security isolation. Add your SSH key to ssh-agent to avoid entering the passphrase repeatedly during your session.



