Skip to main content

Import from Git

Want to start a new Xet repository from an existing Git repo? Start here to migrate your code.

Create a new Xet repository

Begin by initializing a new empty Xet repository from the XetHub UI and cloning it to your local machine.

Navigate to your newly cloned Xet repository and make sure that you're on the main branch:

cd <new-xet-repo>
git checkout main

Migrate code from a Git repository

Existing Git code repositories can be migrated to XetHub while preserving Git history.

  1. From your new Xet repository's directory, add your existing Git repository as a remote named existing:

    git remote add existing <Existing repository's Git URL>
  2. Fetch all branches and commits from existing locally.

    git fetch existing
  3. Rebase against existing/main. This will replay all existing/main commits on the local main branch and then apply all main commits (if any) on top.

    git rebase existing/main
  4. Verify that Git history has been preserved:

    git log
  5. Now that the code and Git history are migrated, remove the existing remote:

    git remote remove existing
  6. (Optional) Reorganize directory structure, if needed, to support the co-location of code and assets.

  7. Force push the main branch to the XetHub remote. The --force is necessary because history was re-written with the rebase command.

    git push --force origin

Your existing Git repository code has now been successfully migrated into a Xet repository!

Used to storing your data separately in S3 or another object store? Follow our docs to move your data into this repository!