How do I rename a Git repository created with gitolite?

I created a Git repository using gitolite. Now I would like to rename that repository.

How can I do this?

  • How can I place my Meteor apps version number in the UI?
  • Git remote tracking branch diverged from local branch with identical commits with different SHAs
  • Failed to push code on git?
  • git pull --rebase --preserve-merges
  • How to revert a git checkout masTER?
  • Is it a good idea to have multiple git repos inside other repo?
  • In gitolite’s readme is says that I should not work directly on the server. But I guess I have to do some work on the server in this case, right?

  • How to configure 'git log' to show 'commit date'
  • What am I Fetching with git fetch?
  • SSL certificate rejected trying to access GitHub over HTTPS behind firewall
  • Composer/WordPress : wp-content directory should or should not be committed
  • Can't find local files after pushing new git branch
  • How do I store a password for my key so I can commit and pull from repository when using git on windows?
  • 4 Solutions collect form web for “How do I rename a Git repository created with gitolite?”

    As stated in the gitolite basic-admin manual:

    renaming a repo

    This is similar; there’s no code to do this in gitolite. What you do is:

    • log on to the server, cd $REPO_BASE (default: cd ~/repositories), and

      mv old-name.git new-name.git

    • back on your gitolite-admin clone, edit conf/gitolite.conf and replace all occurrences of old-name with new-name. Then add, commit, and push as usual.

    The order of these 2 steps is important; do not reverse them 🙂

    A third step is necessary on gitolite3:

    • edit file gl-conf in the repo and change the repository name to the new name

    And of course, every user should update his clone configuration to point to the new repo name.

    I’m not familiar with gitolite specifically, but one approach that might work is to create a completely new repository with the correct name, push your code up into that one, and then delete the old one.

    Using Greg Hewgill as an idea, you possibly can rename the repository in the config file. You may want to try that on a dummy repository first. My suspicions is the old name will be deleted, the new will be created and you need to update your origins locally then push.

    A clean approach is to create the new repository as an empty one, then do the following:

    Assuming old is OLD and new (empty) is NEW:

    # mkdir /tmp/1
    # cd /tmp/1
    # git clone OLD_REPO old
    # git clone NEW_REPO new
    # cd new
    # git pull ../old
    # git push origin master
    

    Or you can use directly the remote repo for OLD:

    # mkdir /tmp/1
    # cd /tmp/1
    # git clone NEW_REPO new
    # cd new
    # git pull OLD_REPO
    # git push origin master
    

    This will keep all history and will let gitolite handle its internals. Additionally you’ll have to update gitolite-admin but there’s not limitation in the order.

    This also works remotely without problems.

    Deleting the OLD repository should be done per gitolite’s instructions (locally) though.

    Git Baby is a git and github fan, let's start git clone.