AI Hints
Home›Git & GitHub Tutorial›Meet GitHub
Git & GitHub · Lesson 55 of 144

Connecting a Remote

Git remote add.

⏱ 2 min read▶ Video at 59:19🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

Your local repository doesn't know about GitHub yet. You connect them with git remote add. You give the remote a short name, and the address.

Connecting a Remote
From the video: Connecting a Remote
  • Local doesn't know GitHub yet
  • git remote add
  • A short name and the address

git remote add

Git remote add, then the name origin, then the address we copied. Origin is just the standard nickname for your main remote. Git remote dash v lists the remotes. Origin appears twice, once for fetching, which means downloading, and once for pushing, which means uploading.

git
git remote add origin https://github.com/sam/my-site.git
git remote -v
origin  https://github.com/sam/my-site.git (fetch)
origin  https://github.com/sam/my-site.git (push)

About origin

Origin isn't special. It's just a name, and most people use it, so you'll see it everywhere. A repository can have several remotes, each with its own name. And if you typed the address wrong, git remote set dash URL fixes it.

originthe usual name
Just a nicknamefor the address
Several remoteseach with a name
Wrong address?git remote set-url

Summary

Git remote add origin, and the address, connects your repository to GitHub. Next, sending your commits up.

Key takeaways
  • git remote add origin <url>
  • git remote -v
  • origin = the main remote
Next up: Pushing to GitHub — git push