Tutorial: How to Manage Remote Repositories with Git
In this tutorial, you will learn how to check the remote URL of your Git repository, as well as how to add and remove a remote repository.
Check the Remote URL
To see which remote repository your Git project is pointing to, you can use the following command:
This command will show you something like the following:
Remove a Remote Repository
If you want to remove a remote repository (e.g., origin
), you can use the following command:
This will remove the reference to the remote repository named origin
.
Add a New Remote Repository
To add a new remote repository, use the following command:
Replace <URL-of-the-new-repository>
with the URL of the new repository you want to point to. For example:
Complete Example
Here is a complete example of how to check, remove, and add a remote repository:
-
Check the Remote URL:
Expected output:
-
Remove the Current Remote Repository:
-
Add a New Remote Repository:
-
Check the New Remote URL:
Expected output:
And that’s it! Now you know how to manage your remote repository URLs in Git.