Easiest way to rename git project configured on BitBucket

GitBitbucket

Git Problem Overview


I have a project hosted on BitBucket

Can I rename it ?

If not and I need to create a new repository can someone tell me the easiest way to do that and have new repo on BitBucket (one particular cause of confusion for me is whether to drive the process locally or from the bitbucket website)

Update

Thankyou Rafal I've followed your instructions and it works great but Im just going to make it a little clearer for noobies like myself (on linux)

  1. In Bitbucket project settings rename project
  2. vi projectname/.git/config and edit url value to reflect new bitbucket repository url
  3. mv projectname newprojectname

Git Solutions


Solution 1 - Git

You can rename the project form the settings menu of the projects on Bitbucket.

Once you rename it, you need to update your git config file to fetch the data from the new location

nano .git/config

Change the name of the project to the new name and save

Solution 2 - Git

I think this is the easiest way:

  1. Rename your project from the bitbucket settings menu
  2. Clone your newly re-named project
  • git clone new_url

This works because git is a distributed version control system. As far as git is concerned there is nothing special about the existing repo on your computer. Just clone a new one.

If you prefer to keep using the existing local repo in my opinion it's easier to use git to update itself instead of manually editing a config file:

  1. Rename your project from the bitbucket settings menu
  2. Change directory into your local project and update git to fetch data from the newly renamed repo
  • git remote set-url origin new_url
  1. Optionally (git doesn't care) rename your local project directory
  • mv projectname newprojectname

Solution 3 - Git

You can also do it in the BitBucket website.

In your project page (https://bitbucket.org/username/yourproject), go to settings, repository details and then change the name and save it.

Solution 4 - Git

To rename your bitbucket repo you can do 2 simple actions:

  1. Rename your repository name in bitbucket repository settings(Your repository>Settings>Name field)
  2. (In case if you have the repository cloned to local machines) In project root directory go to .git folder, then open config file. Change all the old repo names to new repo one.

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPaul TaylorView Question on Stackoverflow
Solution 1 - GitRafalView Answer on Stackoverflow
Solution 2 - GitfrederickfView Answer on Stackoverflow
Solution 3 - GitferrangbView Answer on Stackoverflow
Solution 4 - GitTaras ChernataView Answer on Stackoverflow