Renaming a repository (Bit bucket)



We will be today discussing the process of renaming the repository in Bit bucket or git using command line. We will make sure local copy and remote copy integrate with each other after renaming.

You need to be either an organization owner or have admin permissions for the repository to rename it.

First of we will login into the server we have cloned our repo. Make sure we are in the working copy.

[ec2-user@ip-172-31-88-185 my-repo-test]$ cd ..

[ec2-user@ip-172-31-88-185 ~]$ ls


[ec2-user@ip-172-31-88-185 ~]$ pwd





In this case my repository name is my-repo-test and I will be renaming it to my-repo. First change directory to repository and look for .git folder.

[ec2-user@ip-172-31-88-185 ~]$ cd my-repo-test/

[ec2-user@ip-172-31-88-185 my-repo-test]$ ls -latr

total 4

-rw-r–r– 1 root     root      39 Sep 22 15:19

drwxr-xr-x 3 root     root      35 Sep 22 15:19 .

drwx—— 4 ec2-user ec2-user 110 Sep 22 15:31 ..

drwxr-xr-x 8 root     root     198 Sep 22 15:33 .git



Change the directory to .git look for config file and open the file. Alternatively one can run config command to view remote commit location.

[ec2-user@ip-172-31-88-185 my-repo-test]$ cd .git/

[ec2-user@ip-172-31-88-185 .git]$ ls -ltr

total 28

drwxr-xr-x 2 root root  21 Sep 22 15:19 info

drwxr-xr-x 2 root root 301 Sep 22 15:19 hooks

-rw-r–r– 1 root root  73 Sep 22 15:19 description

drwxr-xr-x 2 root root   6 Sep 22 15:19 branches

drwxr-xr-x 7 root root  60 Sep 22 15:19 objects

drwxr-xr-x 5 root root  46 Sep 22 15:19 refs

-rw-r–r– 1 root root 114 Sep 22 15:19 packed-refs

drwxr-xr-x 3 root root  30 Sep 22 15:19 logs

-rw-r–r– 1 root root 137 Sep 22 15:19 index

-rw-r–r– 1 root root  23 Sep 22 15:19 HEAD

-rw-r–r– 1 root root 285 Sep 22 15:32 config

-rw-r–r– 1 root root 107 Sep 22 15:33 FETCH_HEAD

-rw-r–r– 1 root root  41 Sep 22 15:33 ORIG_HEAD

[ec2-user@ip-172-31-88-185 .git]$ cat config


        repositoryformatversion = 0

        filemode = true

        bare = false

        logallrefupdates = true

[remote “origin”]

        url =

        fetch = +refs/heads/*:refs/remotes/origin/*

[branch “master”]

        remote = origin

        merge = refs/heads/master

[ec2-user@ip-172-31-88-185 .git]$ git config -l











Now one need to use following command to change remote url to new one.

$ git remote set-url origin new_url

[ec2-user@ip-172-31-88-185 .git]$ sudo git remote set-url origin


Now once remote path is changed move repository with the local system to new name to avoid any confusion.

[ec2-user@ip-172-31-88-185 my-repo-test]$ cd ..

[ec2-user@ip-172-31-88-185 ~]$ mv my-repo-test my-repo

[ec2-user@ip-172-31-88-185 ~]$ ls




On the bit bucket side go to setting and rename the repository. And then clock on save repository details.


After all the above operations use git pull to ensure both remote and local repository are communicating.

[ec2-user@ip-172-31-88-185 ~]$ cd my-repo/

[ec2-user@ip-172-31-88-185 my-repo]$ sudo git pull

Password for ‘’:

Already up to date.


To help the readers one can follow step by step video tutorial on Cloud and tech tutorials at below link.




  3 comments for “Renaming a repository (Bit bucket)

  1. Bhumi
    October 3, 2019 at 12:10 pm

    Thanks for sharing this information…

  2. rardTag
    November 3, 2019 at 5:20 am

    hi 🙂 bross 🙂

    • Bhumi Patel
      December 12, 2019 at 8:26 am


Leave a Reply

Your email address will not be published.