Coding/Learn/git/git ssh and remotes
Git & GitHub Complete Course
01.Introduction, Architecture & Configuration
02.Staging Area, atomic Commits & git status
03.Branching, Fast-Forward & 3-Way Merging
04.Stash, Log Visualization & History Inspection
05.Workflows (Git Flow, Trunk-Based) & Semantic Tagging
06.SSH Keys, Remote Repositories & Origin Setup
07.Push, Fetch, Pull & Upstream Tracking Branches
08.Forking, Clones & Open-Source Pull Requests (PRs)
09.GitHub Flow, Branch Protection & GitHub Pages
10.Undoing Changes: git restore & Safe Public git revert
11.Reset: Deep Dive into --soft, --mixed & --hard
12.Commit Amending & Interactive Rebase (git rebase -i)
13.Reflog & Disaster Recovery (Reviving "Lost" Commits)
14.Merge Conflicts Resolution & git rerere
15..gitignore Rules & .gitattributes Cross-Platform Handling
16.Hooks & Automated Quality Assurance (Pre-Commit)
17.Submodules & Large File Storage (Git LFS)
18.GPG Cryptographic Signing & git cherry-pick
19.Advanced Remotes, Garbage Collection (git gc) & Maintenance
20.Capstone: Production Multi-Branch Enterprise Release Pipeline
Course Certificate0%

Complete all lessons to earn

LearnSSH Keys, Remote Repositories & Origin Setup
6 / 20 0%
Lesson 06 of 20
6 mins read

SSH Keys, Remote Repositories & Origin Setup

PreviousNext Lesson
In Plain English

Git connects to central hosting platforms (GitHub, GitLab, Bitbucket) through remote handles. The standard origin remote stores the fetch and push URLs. Authentication is handled securely via modern Ed25519 asymmetric SSH keypairs without transmitting raw passwords.

The Mental Model

"An SSH keypair is a physical lock and key: you install the public lock on GitHub's door, and keep the private key safely in your pocket (~/.ssh/id_ed25519). When connecting, Git turns the key to prove your identity instantly."

Deep Dive: How It Works

Ed25519 Key Generation: ssh-keygen -t ed25519 -C "[email protected]" generates a modern high-security curve keypair.

Remote Configuration: git remote add origin [email protected]:user/repo.git binds the shorthand name origin.

Inspecting Remotes: git remote -v displays exact fetch and push endpoints.

Syntax Blueprint

ssh-keygen -t ed25519 -C "[email protected]"
git remote add origin [email protected]:zencompiler/core.git
git remote -v

Generate SSH key, add origin remote URL, and verify configured remotes.

PointCore Rules to Remember

Point star
Asymmetric SSH Keys: Public key (~/.ssh/id_ed25519.pub) is uploaded to GitHub; private key remains strictly on your local machine.
Point star
Multiple Remotes: A repository can track multiple remotes (e.g. origin for your fork, upstream for the official source).
Point star
HTTPS vs SSH: SSH provides seamless key-based token authentication without entering Personal Access Tokens (PAT) on every push.

Common Beginner Traps & How to Fix Them

Mistake:Sharing your private SSH key (~/.ssh/id_ed25519) instead of the public key (.pub).

Why it happens: Mistaking private and public files.

How to fix: Only ever upload the file ending in .pub to GitHub settings.

Pro Tip: Test your SSH authentication with GitHub using ssh -T [email protected].

Live Interactive Example

Hit Run Code to see it live
Configure Remote URL
Git 2.45 / CLI
1
2
3
4
Output Console
Click "Run Code" to view the rendered output.
How it works: git remote -v displays both the read (fetch) and write (push) target endpoints for origin.

Your Turn: Micro Challenge

No pressure! Edit the starter code below and test your solution with instant feedback.

Micro Exercise

Add Upstream Remote

  • PointAdd a remote named "upstream" pointing to "https://github.com/zencompiler/upstream-core.git".
  • PointList all remotes using "git remote -v".
1
2
3
4
5
6
7
8
Sandbox Output
Click "Run & Check" to test your solution.

Finished reading and practicing?

Mark this lesson as completed to update your course progress.

PreviousNext Lesson
Overview100 SheetLearnCertificates