How do I change the remote URL for a remote Git repository?

Change the remote URL to your repository:

To change the remote URL for a repository, you will need to update the configuration file with the new URL. Otherwise, you'll get an error when attempting to push your repository. If you don't want to edit the configuration file, you can also clone the repository from the new location. If you clone, be aware that you'll lose any changes you made but had not pushed to Bitbucket before the transfer.

 

To check remote path of your current repository run the following command

remote -v  

 

To Update the remote URL with git remote set-url using the current and new remote URLs.

git remote set-url origin https://github.com/testusername/testRepo.git 

Tags:

git

Share:

Related posts