Migrate to Harvard Enterprise GitHub (code.harvard.edu)

 

To migrate a repository from a git based version control (like github, Bitbucket , code.seas.harvard.edu , etc ) to Harvard Enterprise GitHub

  1. Create a repository in code.harvard.edu 
  2. Use git commands to move the repository contents. 

Example: Suppose we want to migrate my_test_repo (git@bitbucket.org:my_project/my_test_repo.git) from Bitbucket to Harvard Enterprise GitHub. 

Create new repository "my_test_repo" in code.harvard.edu using the UI or API

   Using the website

   Or with API calls

Note that token and API calls are useful if you want to automate things or move multiple repositories at once.

Migrate the repository

  • Clone the old repository 

  • Remove the old repository remote URL

  • Add the new remote repository URL, 

  • push to the remote repository.

git clone --mirror git@bitbucket.org:my_project/my_test_repo.git
cd my_test_repo
git remote remove origin
git remote add origin git@code.harvard.edu:SEAS/my_test_repo.git
git push origin --mirror
  • The "–mirror" option is to map all the branches and tags.

  • You need to setup SSH keys to the push to a repository in code.harvard.edu

Remove your token

if you created a token above, then delete it

go to : https://code.harvard.edu/settings/tokens then delete it.

 

Copyright © 2024 The President and Fellows of Harvard College * Accessibility * Support * Request Access * Terms of Use