Work About Team Blog Tutorials FAQ
Book a discovery call → Chat on WhatsApp

Home / Blog / DevOps & Cloud / How to change/delete/remove an existing remote URL in Git?

developergithubdevelopmentproductivitydevops

How to change/delete/remove an existing remote URL in Git?

💡
Cross-posted content: This article is also published on Medium. View original on Medium ↗

Welcome to my another blog on GitHub. I’m a fan of it and trying to dive deeper and deeper into it so as to get the best out of it. I try to simplify things as much as possible so bear with my posts if they sound boring.

So today I had a task to migrate my GitHub repo to Bitbucket so I made all the setup in the bucket and created a new repo there. However, now to continue with all the operations of GitHub and to make sure I do all the remote or server operations on Bitbucket instead of GitHub I had to set the remote URL of Bitbucket repo instead of GitHub in my local Git.

Note: remote means github.com or any other sites like it where we can push our code online and alias mean a nickname for the URLs of the repository.

There are 3 ways to do it.

Actually there is really a one way that you’ll need but I’m trying to hand you over with other ways which may come handy at some later point of time.

1. Update or change the URL

This is a quite a straightforward way to do it. Just one command and you are done.

The command is: git remote set-url < alias-name>

2. Delete the existing remote alias (origin) and create it again.

Step1: Deleting the remote alias.

The command to remove or delete existing remote is pretty straightforward.

git remote remove

Step2: Adding the remote URL(aka adding origin)

git remote add

3. Adding the remote URL with different alias name and use it.

This is also a simple step and can be useful if you are in a need to push your code to more than one remote. Maybe a need to push the code on both GitHub and Bitbucket. Who knows when this can come handy?

git remote add

So that’s all we gotta do. Few simple git commands that can save you get your work done. I’ll be up with more content on GitHub, so stay tuned.

Full-Stack Web Engineering

Need technical precision for your web stack?
Architected for performance & scale.

From modern headless commerce to enterprise infrastructure and clean frontend state systems, Klickspell delivers senior engineering craft without agency bloat.

Book Free Technical Call → Explore Headless Engineering ↗

Keep Reading

Related Engineering Articles

programminggit

Git is Lit | An attempt to explore the BTS of Git Operations | Part 0(Version Control)

Sometimes it’s better to start instead of waiting for the right moment. Because you never know if it will arrive or not. And there is always a possibility of ma...

4 min read Read →
javascriptwebdev

Useful Tips for Web Dev - Part1

A lot of time there are some problems which we face occasionally but the time when that occasion...

2 min read Read →

Technical Blog

Explore all 50+ engineering tutorials

All Articles ↗

Looking for custom
Shopify engineering craft?

Let's build
your store right.

Book a free 30-minute call. We'll talk through your store goals, timeline, and budget.

Free 30-min call · Discuss scope & budget

Book your free call → Chat on WhatsApp

The craft in every click.