In this tutorial, we will change the remote repository URL of a project.
Imagine we have our project repository codebase in a specific hosting provider like GitLab. Our management has decided to migrate to another hosting provider like GitHub. In that case, we need to change the remote repository URL.
Steps to Follow:
1. Navigate to the local repository directory where you want to update the remote URL.
2. Open your terminal or command prompt.

3. Use the following command to view the current remote URLs associated with your repository:
git remote -v

4. Identify the name of the remote repository for which you want to change the URL (e.g., origin). Here, I want to push the code to GitHub. So, will change the URL to GitHub one.
5. To change the URL, use the “git remote set-url” command followed by:
– The name of the remote repository.
– The new URL that you want to set.
For example, I want to change the URL of a remote named “origin” to a new URL “https://github.com/vibssingh/Serenity_Cucumber_JUnit5.git“, run this command:
git remote set-url origin https://github.com/vibssingh/Serenity_Cucumber_JUnit5.git

6. Verify that the new URL has been set correctly by running “git remote -v” again.

7. You can now push and pull changes using the updated URL for your remote repository.

Congratulation!!! We have understood the use of git set-url command.