Renaming a Bitbucket Repository

Bitbucket is a paid-for version of Github*. Along with Jira and Confluence, it forms the Atlassian framework, a suite of devops tools in widespread use.

Using the Bitbucket web interface, a repository can easily be renamed. However, this causes a change in the URL, which breaks the link from existing clones of the repo. They can be deleted and re-cloned, or renamed. This post explains how to do the rename.

1. Rename the Repository in Bitbucket

In a browser, log into Bitbucket and surf to the repository of interest. Click the gearwheel button on the left (“Repository settings”) and do a simple rename. For this example, I took a repo called “ansible-roles” and changed its name to “orchestration“.

2. Rename any Cloned Copies

The above breaks the URL configured into the cloned copy on my local machine. Check the URL with “git config –list”. It can be seen that the local git is still pointing to the old name:

$ git config --list

Update the local repo with “git remote set-url”:

$ git remote set-url origin

A final check confirms the change:

$ git config --list


The Atlassian Bitbucket version was v5.5.0. Local git version was 2.1.4, running on Debian 8.9.

*Github is free for public repos.  Bitbucket, although primarily commercial, also offers a free service for private repositories and up to 5 users.

4 thoughts on “Renaming a Bitbucket Repository

  1. I note you say “Bitbucket is a paid-for version of Github”. Quite the opposite. For many years Bitbucket was the free alternative to Github when it came to *private* repositories.

    • Hi John. Bitbucket does indeed offer a free service. At the time of writing, up to 5 users can share unlimited private repos. Article updated accordingly.

  2. I used the procedure mentioned to rename the repository name in bitbucket and update the url to new url.

    However,i was of the impression this rename and set-url combination should have removed any references to old repository name and its url.What i see is that i am still able to clone to the old repo.
    Do i need to do an explicit git remote rm on the old url ?

    • Hi Shaan, that doesn’t sound right. It doesn’t seem to make sense that the repo can still be cloned on its old name. Unfortunately I don’t have access to a Bitbucket installation any more, so I can’t check it. Cheers, Jim.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.