Connecting Local & Remote Repositories

๐Ÿ“˜ Git & GitHub ๐Ÿ“— Chapter 15 of 40 ๐Ÿ“‚ Phase 5: Remote Repositories ๐Ÿ—“๏ธ 2026 Edition
๐Ÿ“Œ Covered in this chapter: git remote add ยท origin ยท HTTPS vs SSH URLs ยท Managing Remotes

Link your local Git repository to a GitHub remote so you can push and pull changes.

1Connecting Local & Remote Repositories โ€” What You'll Learn

Link your local Git repository to a GitHub remote so you can push and pull changes.

Here's everything this chapter covers, in the order you'll learn it:

  • What a 'remote' is in Git
  • git remote to view configured remotes
  • Adding a remote named origin
  • Checking your configured remotes
  • HTTPS remote URLs
  • SSH remote URLs
  • Renaming a remote
  • Removing a remote
  • Remote-tracking branches
  • Why the default remote is conventionally called 'origin'
2Working Example
๐Ÿ’ป Example: Connecting Local & Remote Repositories
Bash
git remote add origin https://github.com/username/my-project.git
git remote -v
3Best Practices & Common Pitfalls
๐Ÿ’ก Key things to remember:
  • 'origin' is just a convention/nickname for your primary remote โ€” you could name it anything, but almost every team sticks with 'origin' for consistency.
โ“ Frequently Asked Questions (FAQ)

Q What's the most important thing to understand about connecting local & remote repositories?

Focus on: git remote add ยท origin ยท HTTPS vs SSH URLs ยท Managing Remotes. These are the core building blocks this chapter's examples are built around, and they show up repeatedly in later chapters of this course.

Q Is connecting local & remote repositories something I'll use often in real projects?

Yes โ€” every concept in this chapter reflects a real, everyday part of professional Git and GitHub workflows, not just a theoretical exercise.

OC
Written by Our Compiler Technical Editorial Team
Reviewed for accuracy ยท Last updated August 2026