• iconteach@devfunda.com

Remote Repository on GitHub

Remote Repository on GitHub

24-08-2025 00:00:00 Time to read : 12 Minutes

Until now, we’ve been working with Git locally on our computer.
But what if you want to:

  • Back up your project online
  • Share your project with classmates or teammates
  • Collaborate on the same code

That’s where a Remote Repository (like GitHub) comes in.

Step 1: Create a Repository on GitHub

  1. Go to GitHub.com
  2. Click New Repository
  3. Give it a name (e.g., my-first-git-project)
  4. Choose visibility - Choose who can see and commit to this repository, select private for now.
  5. Leave it empty (don’t add README yet if you already have files locally).
  6. Click Create Repository

Now GitHub gives you a repository URL: https://github.com/username/my-first-git-project.git  

You can take this repository url from:
git url

  1. Click on repository
  2. Click on Clone
  3. Click on HTTPS

Step 2: Link Your Local Repo to GitHub

git remote add origin https://github.com/username/my-first-git-project.git

Here:

  • remote:  connects your local repo to GitHub
  • origin: is the default name Git gives to your GitHub repository

Step 3: Push Your Code to GitHub
Send your local commits to GitHub:

git push -u origin main
  • push: sends changes to GitHub
  • -u: sets "origin main" as the default so next time you can just use git push
  • main: is the branch name (sometimes it might be master)

Step 4: Verify on GitHub

  • Go back to your GitHub repo page
  • Refresh You’ll see your files uploaded

Step 5: Clone a Repository (Other Way Around)

Cloning means making a full copy of a project from GitHub onto your computer.

Steps to Clone a Repo:

  • Open the folder on your computer where you want to download the project.
  • Example: C:\Projects 
  • Open Command Prompt / Terminal inside that folder.
  • Run the git clone command:
git clone https://github.com/username/project.git

After this, a new folder named project will be created.
Inside it, you’ll find all the project files.

Git also copies the complete history of commits.

Want to learn in class