Categories
git

How to migrate a git repo to gogs?

Gogs is a self-hosted git server that describes itself as:

Gogs a painless self-hosted git service

How to Migrate a Git Repo to Gogs

To migrate a git repo to gogs – the process is to clone the repo in mirror mode and then push it to gogs in mirror mode. This method will work no matter if you are using: vanilla bare git repos, github, gitlab or another self-hosted solution.

Mirror mode is: --mirror create a mirror repository (implies bare)

  1. Create the new repo in gogs under the organisation or user you want it to appear as.

gogs-create-repo

  1. Copy the cloning url

  2. Clone the orginal repo in mirror mode to a machine somewhere

    git clone --mirror git@:.git
  3. Change directory

    cd .git
  4. Push to new gogs repo from the mirrored clone repo

    git push --mirror git@.git

Sources