Git remotes help you manage repositories in a remote server by storing the URL identified with a name. If you migrate the repository to another service, all you need is to change the URL. The default name of cloned repositories remote is origin, and you can have multiple named remotes if you want.
To change the Git remote URL for your local repository, you can use the following command replacing the
$ git remote set-url <remote_name> <remote_url>
If you want to verify that the remote was updated, you can list them out:
$ git remote -v > origin email@example.com:username/repo_name.git (fetch) > origin firstname.lastname@example.org:username/repo_name.git (push)
- “Git - Git-Remote Documentation.” Accessed September 28, 2021. https://git-scm.com/docs/git-remote.
- “How to Change a Git Remote’s URL,” October 29, 2019. https://linuxize.com/post/how-to-change-git-remote-url/.