New to Bitbucket Cloud? Check out our get started guides for new users.
To change the remote URL for a repository, you'll 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.
The URL you use for a repository depends on which protocol you're using: HTTPS or SSH. You can find these URLs from the Clone button on the Source page of your repository.
You can click back and forth between the SSH and the HTTPS protocol links to see how the URLs differ. The table below shows how the formats vary based on protocol.
You'll see these names as part of the URL:
In place of <repo_name>, you'll see the repository name.
In place of <workspace_ID> in the HTTPS URL format, you'll see the workspace ID for your workspace.
Git repository URLs
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://firstname.lastname@example.org/tutorials/tutorials.git.bitbucket.org.git (fetch)
origin https://email@example.com/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 firstname.lastname@example.org: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.