Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jvc-byte/how-to-generate-and-add-ssh-key-to-github
Simple Steps to generate and add SSH key to your GitHub account
https://github.com/jvc-byte/how-to-generate-and-add-ssh-key-to-github
add-ssh-key generate-ssh-key ssh-key
Last synced: 2 days ago
JSON representation
Simple Steps to generate and add SSH key to your GitHub account
- Host: GitHub
- URL: https://github.com/jvc-byte/how-to-generate-and-add-ssh-key-to-github
- Owner: jvc-byte
- Created: 2024-08-08T20:12:12.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-18T08:26:41.000Z (3 months ago)
- Last Synced: 2024-10-12T11:09:36.379Z (about 1 month ago)
- Topics: add-ssh-key, generate-ssh-key, ssh-key
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# How-to-generate-and-add-SSH-key-to-GitHub (Linux CLI)
## The below are verified steps to add SSH key to your GItHub account (Linux CLI):
### 1. Check for Existing SSH Keys:
```bash
ls -al ~/.ssh
```
There should be files named `id_rsa` (private key) and `id_rsa.pub` (public key) or similarly named key pairs.
If there is no SSH key available you will receive a message like: `ls: cannot access '/c/Users/dell/.ssh': No such file or directory`
### 2. Generate a New SSH Key (if there is no SSH available else skip No. 2)
```bash
ssh-keygen -t rsa -b 4096 -C "[email protected]"
```
Follow the prompts properly to save the key, and you can press Enter to accept the default file location. When prompted for a passphrase, you can choose to set one or leave it empty by pressing Enter.
### 3. Type the below command to add the SSH Key to the SSH Agent
```bash
eval "$(ssh-agent -s)"
```
```bash
ssh-add ~/.ssh/id_rsa
```
### 4. Add Your SSH Key to Your GitHub Account
Copy your SSH key to your clipboard:
```bash
cat ~/.ssh/id_rsa.pub
```
Go to [GitHub SSH settings](https://github.com/settings/keys), click "New SSH key," paste your key, and save it.
### 5. Test your SSH connection to GitHub:
```bash
ssh -T [email protected]
```
You should see a success message like:
```
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
```
### 6. Update the Remote URL.
Ensure your repository's remote URL uses the correct SSH format. Run:
```bash
git remote -v
```
If it shows a URL starting with `https://`, update it to the SSH format:
```bash
git remote set-url origin [email protected]:jekhokie/raspberry-noaa-v2.git
```
### 7. Try cloning the repository again:
```bash
git clone [email protected]:jekhokie/raspberry-noaa-v2.git
```
This will resolve the `Permission denied (publickey)` issue and successfully clone your repository via SSH.