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
...
remote.origin.url=ssh://git@git.example.com/op/ansible-roles.git

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

$ git remote set-url origin https://git.example.com/scm/op/orchestration.git

A final check confirms the change:

$ git config --list
...
remote.origin.url=https://git.example.top/scm/op/orchestration.git

Note

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

Leave a Reply

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