Add SSH Keys to Your GitHub/Gitlab Account and Clone a Repository
Step 1: Generate SSH Keys
Open your terminal and type the following command:
ssh-keygen
Press enter to accept the default file location and passphrase.
Step 2: Copy Public Key
Copy the generated public key to your clipboard using:
cat ~/.ssh/id_rsa.pub
Step 3: Add SSH Key to GitHub
- Go to your GitHub account settings and click on “SSH and GPG keys.”
- Click on “New SSH key,” paste your public key, give it a title, and save.
Step 4: Clone the Repository
- Visit the repository on GitHub and click on “Code.”
- Choose SSH as the clone method and copy the SSH URL.
Step 5: Clone the Repository in Terminal
In your terminal, type:
git clone [SSH_URL]
Replace [SSH_URL] with the copied SSH URL. You should be able to clone the repository without entering your username and password.
By following these steps, you ensure a secure and efficient way to connect to your GitHub repositories using SSH keys.
Watch Full Video tutorial:
Discover more from TheFlipbit
Subscribe to get the latest posts to your email.
