Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026
The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.
A Git remote is a reference to a repository hosted elsewhere, typically on a service like GitHub, GitLab, or BitBucket.
Understanding how to manage remotes is essential when you need to change where your repository is hosted or work with multiple remote repositories.
Viewing Remotes
To see which remotes are configured for your repository:
git remote -v
This lists all remotes along with their URLs for fetching and pushing.
Adding a Remote
To add a new remote to your repository:
git remote add origin git@github.com:username/repo.git
The origin is the conventional name for your primary remote, but you can use any name. Change username/repo to match your actual repository URL.
You might need to add a remote when:
- You initialized a local repository and want to connect it to GitHub
- You want to add a second remote for deploying to a different service
- You removed the old remote and need to add a new one
Removing a Remote
To remove a remote from your repository:
git remote rm origin
This removes the reference to the remote repository. It doesn’t delete the remote repository itself, just your local reference to it.
Common scenarios where you’d remove a remote:
- Moving your project to a different hosting service
- Creating an archive copy of a website with its own repository
- Cleaning up after a project restructure
After removing a remote, git remote -v won’t return anything for that remote name.
Renaming a Remote
To rename an existing remote:
git remote rename old-name new-name
Adding a New Remote After Removal
A common workflow is removing the old remote and adding a new one:
# Remove the old remote
git remote rm origin
# Add the new remote
git remote add origin git@github.com:username/new-repo.git
# Push to the new remote
git push -u origin main
If you use GitHub Desktop, you can also drag your folder into the app after removing the remote, and it will help you create a new GitHub repository.