How to change the remote url for your local git repositoryPosted in Applications -
If you've moved a git repository from one git hosting service to another, transferred from one account to another at the same service (here's how to transfer between accounts at Bitbucket) or moved your own repository servers around the place, you'll need to change the remote url for you local repository to be able to continue pushing and pulling changes, etc.
Check the existing remotes
Use this command to check what you have configured as the current remote:
git remote -v
If the git repository is at e.g. Bitbucket, the login name MyUsername and the repository coolproject, then running the above command would output something like this:
origin git@bitbucket.MyUsername/coolproject.git (fetch) origin email@example.com:MyUsername/coolproject.git (push)
Change the remote url
To change your local repository's origin to e.g. another accout within Bitbucket (YourUsername), use the set-url command like so:
git remote set-url origin firstname.lastname@example.org:YourUsername/coolproject.git
Done! You might want to run "git remote -v" again to check it's all looking good.