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
Log into your GitHub account.
2
In the upper-right corner, click the + icon and select New repository.
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
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.