Migrate a cvs repository to git bare repository on Ubuntu Linux

  1. Install git-cvs package which includes the migration tools:
    sudo apt-get install git-cvs
  2. Set the cvs repository to read-only:
    sudo chmod -R ugo-w /path/to/CVSROOT
  3. Make the root directory for git and give permissions to the dev-users group:
    sudo mkdir /path/to/git
    sudo chgrp dev-users /path/to/git
    sudo chmod 6775 /path/to/git
    sudo chmod +t /path/to/git
  4. Migrate the cvs modules into git (in the example below, proj1 is the name of the cvs module and it is also used as the name of the git directory):
    cd /path/to/git
    git cvsimport -k -i -d /path/to/CVSROOT -C proj1 proj1
  5. Rename the git project directory:
    sudo mv /path/to/git/proj1/.git /path/to/git/proj1.git
    sudo rmdir /path/to/git/proj1
  6. Fix permissions of the git project directory:
    sudo chgrp -R dev-users /path/to/git/proj1.git
    sudo chmod -R ug+w /path/to/git/proj1.git
    sudo chmod +s /path/to/git/proj1.git
    cd /path/to/git/proj1.git
    # the hooks/ and info/ dirs are special since the control repository access
    sudo chgrp -R git-admin hooks info config description
    sudo find -type d -exec chmod +s {} \;
  7. Configure the git project to be bare git repository:
    cd /path/to/git/proj1.git
    git config --bool core.bare true
    git config --bool receive.denyNonFastforwards true
    git config core.sharedRepository group
    The config file should be look like below:
        repositoryformatversion = 0
        filemode = true
        bare = true
        sharedRepository = group
        logallrefupdates = true
        denyNonFastforwards = true

See also

  1. Optimize git repository in crontab using git-gc
  2. Git Book - Set up a public repository
  3. Git Book - Set up a private repository
  4. Git bare vs. non-bare repostiroies


No comments:

Post a Comment