Skip to content

Repository Migration

asgreen21 edited this page Nov 6, 2023 · 6 revisions

Git Migration

Here's one way to migrate from an existing git repository into GitHub.

  1. Create a New GitHub repository

    1. Leave this repository empty for now.

      https://github.com/The-Vanderbilt-University/vuit-rep-creation-iac

  2. Create a fresh clone of your old repository

    $ git clone --mirror <OLD PROJECT REPO >.git
    
  3. Change the remote to your new repo

    $ cd OLD_PROJECT_REPO_DIR
    $ git remote set-url origin <NEW PROJECT REPO>.git
    
  4. Push to GitHub

    $ git push --mirror origin
    
  5. Default Branch

    Make sure your default branch is configured as you expect. By, default, GitHub repositories are created with main as the default branch. If your project has no branch named main, you'll need to go into the repository settings and update your default branch.

What now?

All Tags and Branches?

The above migration process will include all branches and tags.

What about my old Repo?

Once the above steps are complete, your repository will exist in both places. You'll probably want to delete or archive your old repository to avoid confusion.

Clone this wiki locally