Create a new SSH key

Create a new SSH connection between your local machine and GitHub 1️⃣ Open the Git Bash and generate a New SSH Key cd C:\MyPath\GitHub\ (it's custom path for ssh key) ssh-keygen -t ed25519 -C "my-key" Enter file in which to save the key (C:\Users\someuser.ssh\id_ed25519): C:\MyPath\GitHub\key C:\MyPath\GitHub\key already exists. Overwrite (y/n)? y 2️⃣ Add SSH Key to SSH Agent Start the ssh-agent: eval "$(ssh-agent -s)" Add your new SSH private key: ssh-add key 3️⃣ Copy the SSH Public Key cat key.pub | clip 4️⃣ Add the SSH Key to Your GitHub Account Log in to GitHub Go to Settings > SSH and GPG keys Click New SSH key Paste your key into the "Key" field Add a descriptive title Click Add SSH key 5️⃣ Test the SSH Connection ssh -T git@github.com Summary: - Generate SSH key (ssh-keygen) - Add key to SSH agent (ssh-add) - Copy public key (cat ~/.ssh/id_ed25519.pub) and add to GitHub - Test connection (ssh -T git@github.com) - Use SSH URL for repositories Guide to add a file, commit your changes, and prepare for pushing to GitHub: Step 1. Add your new or modified files To stage a specific file: git add filename To stage all changed files: git add . Step 2. Commit your changes Create a commit with a descriptive message: git commit -m "Your commit message" Step 3. Push your changes to GitHub git push origin main

May 8, 2025 - 17:15
 0
Create a new SSH key

Create a new SSH connection between your local machine and GitHub

1️⃣ Open the Git Bash and generate a New SSH Key

cd C:\MyPath\GitHub\ (it's custom path for ssh key)
ssh-keygen -t ed25519 -C "my-key"
  • Enter file in which to save the key (C:\Users\someuser.ssh\id_ed25519): C:\MyPath\GitHub\key
  • C:\MyPath\GitHub\key already exists.
  • Overwrite (y/n)? y

2️⃣ Add SSH Key to SSH Agent
Start the ssh-agent:

eval "$(ssh-agent -s)"

Add your new SSH private key:

ssh-add key

3️⃣ Copy the SSH Public Key

cat key.pub | clip

4️⃣ Add the SSH Key to Your GitHub Account

  • Log in to GitHub
  • Go to Settings > SSH and GPG keys
  • Click New SSH key
  • Paste your key into the "Key" field
  • Add a descriptive title
  • Click Add SSH key

5️⃣ Test the SSH Connection

ssh -T git@github.com

Summary:

- Generate SSH key (ssh-keygen)
- Add key to SSH agent (ssh-add)
- Copy public key (cat ~/.ssh/id_ed25519.pub) and add to GitHub
- Test connection (ssh -T git@github.com)
- Use SSH URL for repositories

Guide to add a file, commit your changes, and prepare for pushing to GitHub:

Step 1. Add your new or modified files
To stage a specific file:

git add filename

To stage all changed files:

git add .

Step 2. Commit your changes
Create a commit with a descriptive message:

git commit -m "Your commit message"

Step 3. Push your changes to GitHub

git push origin main