-
Notifications
You must be signed in to change notification settings - Fork 0
Repository Migration
Here's one way to migrate from an existing git repository into GitHub.
-
Create a New GitHub repository
-
Leave this repository empty for now.
https://github.com/The-Vanderbilt-University/vuit-repo-creation-iac
-
-
Create a fresh clone of your old repository
$ git clone --mirror <OLD PROJECT REPO >.git -
Change the remote to your new repo
$ cd OLD_PROJECT_REPO_DIR $ git remote set-url origin <NEW PROJECT REPO>.git -
Push to GitHub
NOTE: GitHub uses
mainas the default branch. Two options for importing are provided below.$ git branch -m master main $ git push --mirror origin$ git push --mirror origin- Navigate to your repo's settings and update your default branch.
The above migration process will include all branches and tags.
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.
If you'd like to change your default branch from master to main on an existing repo, follow these steps:
-
Navigate to your repo's settings and update your default branch.
-
Update master to main locally
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a