MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Creating a Remote Repository and Connecting with git remote add0%
Study Materials
Git & GitHub BasicsProgress 0%
1.1What is Version Control? (Local, Centralized vs Distributed VCS)1.2Why Git? History, Architecture & Core Benefits1.3The Three Trees: Working Directory, Staging Area & Git Repository1.4Installing Git and Initial Configuration (git config user.name / email)
5.1What is GitHub? Remote Hosting, Social Coding & Open Source5.2Setting up SSH Keys, Personal Access Tokens (PAT) and Authentication5.3Creating a Remote Repository and Connecting with git remote add5.4Pushing and Pulling Code: git push -u origin main and git pull
HomeTutorialsGit & GitHub BasicsCreating a Remote Repository and Connecting with git remote add
Pushing and Pulling Code: git push -u origin main and git pull

Creating a Remote Repository and Connecting with git remote add

Beginner12 min read•Updated: 2026-09-15•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

Connecting your local repository to a remote repository on GitHub bridges your local computer with the global cloud. The git remote command manages these connections.


1. Creating a Remote Repository on GitHub

  1. 1
    Log into your GitHub account.
  2. 2
    In the upper-right corner, click the + icon and select New repository.
  3. 3
    Fill in the repository details:
  • Repository name: e.g., ecommerce-dashboard.
  • Description: Short explanation of the project.
  • Visibility: Choose Public (visible to the world) or Private (restricted to you and invited collaborators).
  • Initialize this repository with:
  • > [!IMPORTANT]
  • If you are pushing an existing local repository, uncheck "Add a README file", .gitignore, and license! Creating these on GitHub will create an initial commit on GitHub, causing diverged history that blocks your first push.
  1. 1
    Click Create repository.

2. Understanding Git Remotes: The origin Convention

A remote in Git is simply an alias (a bookmark shortcut) pointing to the URL of a repository hosted on the internet or a local network.

By universal convention in the Git ecosystem, the primary default remote repository is named origin.

1Local Repository Remote Repository on GitHub
2[ D:/projects/app ] <=========== origin ============> [ https://github.com/sumit/app.git ]

3. Connecting Local Repo to Remote (git remote add)

GitHub displays quick-setup terminal instructions. To link your existing local repository to the remote URL:

Using SSH URL (Recommended):

1git remote add origin git@github.com:sumit-msk/ecommerce-dashboard.git

Using HTTPS URL:

1git remote add origin https://github.com/sumit-msk/ecommerce-dashboard.git

4. Managing and Inspecting Remotes

A. List Configured Remotes

1git remote
2# Output: origin

B. List Remotes with Fetch and Push URLs (-v verbose)

1git remote -v

Output:

1origin git@github.com:sumit-msk/ecommerce-dashboard.git (fetch)
2origin git@github.com:sumit-msk/ecommerce-dashboard.git (push)

C. Change a Remote URL (set-url)

If you switch from HTTPS to SSH or if the repository was renamed:

1git remote set-url origin git@github.com:sumit-msk/new-repo-name.git

D. Remove an Outdated Remote (remove)

1git remote remove origin

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
What is a Git remote?
Question 2
What is the conventional default name given to the primary remote repository in Git?
Question 3
What command links a local repository to a remote GitHub repository URL under the alias origin?
Question 4
Which command displays all configured remotes along with their target fetch and push URLs?
Question 5
If you already have a local project with commits, why should you uncheck "Add a README" when creating a new GitHub repo?
Next Lesson

Pushing and Pulling Code: git push -u origin main and git pull

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Setting up SSH Keys, Personal Access Tokens (PAT) and AuthenticationPushing and Pulling Code: git push -u origin main and git pull

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master Git & GitHub Basics with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext