How to update the URL for Git repositories
- From a terminal, navigate to the repository. $ cd ~/<path_to_repo>
- Run git remote -v to see the current remote URL.
- $ git remote -v
- origin https://[email protected]/tutorials/tutorials.git.bitbucket.org.git (fetch)
- origin https://[email protected]/tutorials/tutorials.git.bitbucket.org.git (push)
- Update the remote URL with git remote set-url using the current and new remote URLs.
- $ git remote set-url origin [email protected]:tutorials/tutorials.git
If you update your URL from HTTPS to SSH, next time you push or pull from your repository, the terminal responds that it is adding the Bitbucket host to the list of known hosts. You also won't have to enter a password.