How to change the URI (URL) for a remote Git repository?
In this post we will give you information about How to change the URI (URL) for a remote Git repository?. Hear we will give you detail about How to change the URI (URL) for a remote Git repository? And how to use it also give you demo for it if it is necessary.
What is Git?
Git is the world’s most popular distributed version control system used by many open-source and commercial projects. It allows you to collaborate on projects with your fellow developers, keep track of your code changes, revert to previous stages, create branches, and more. Linus Torvalds (the creator of Linux) developed Git.
Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows.
A version control system is a system that keeps a record of the changes in a file (or multiple files) over a period. This is so that a user may return to a previous version of the system’s software whenever necessary.
Features of Git
- Tracks history.
- Free and open source.
- Supports non-linear development.
- Creates backups.
- Scalable.
- Supports collaboration.
- Branching is easier.
- Distributed development.
Also see: How to Install Git On Ubuntu 20.04
What is Git Remote URI(URL)?
Git remote is a pointer that refers to another copy of the repository that is usually hosted on a remote server.
In some situations, like when the remote repository is migrated to another host, you need to change the remote’s URL.
In this tutorial, you are going to learn how you can change the URL of a Git remote easily.
Changing a Git Remote’s URL
Each Git repository can have zero or more Git remotes linked to it. When you clone a repository, the name of the remote is set automatically to origin and points to the repository that you cloned from.
Follow the steps below to change the URL of a remote:
1. Change to the directory where the repository is located:
cd /path/to/repository
2. Run git remote
to list the existing remotes and see their names and URLs:
git remote -v
3. Use the git remote set-url
a command followed by the remote name, and the remote’s URL:
git remote set-url <remote-name> <remote-url>
If you’re changing to HTTPS, the URL will look something like this:
https://gitserver.com/user/repo_name.git
If you’re changing to SSH, the URL will look like this:
[email protected]:user/repo_name.git
4. Verify that the remote’s URL was successfully changed by listing the remote connections:
git remote -v
That’s it. You have successfully changed the URL of the remote.
Thank you for reading this blog.
Also see: How to Install OpenLiteSpeed on Ubuntu 20.04
. .
Hope this code and post will helped you for implement How to change the URI (URL) for a remote Git repository?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs