To migrate a repository from a git based version control (like github, Bitbucket , code.seas.harvard.edu , etc ) to Harvard Enterprise GitHub
- Create a repository in code.harvard.edu
- Use git commands to move the repository contents.
Example: Suppose we want to migrate my_test_repo (firstname.lastname@example.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
- Login to code.harvard.edu
- Create new repository, for help use: https://help.github.com/articles/create-a-repo/.
Or with API calls
Note that token and API calls are useful if you want to automate things or move multiple repositories at once.
Create a personal token in code.harvard.edu:
fill out the Token description
check the "Repo" box in the Select Scope.
For more help with the personal token look at: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line
For Simplicity, assign the token value to a variable (say AUTH_TOKEN).
Create a repository (private or public) in your organization (Like SEAS). Note that the list of available parameters to create a repository can be found here: https://developer.github.com/v3/repos/
- Write down the repository ssh URL . In this case it is "ssh_url": "email@example.com:SEAS/my_test_repo.git",
Migrate the repository
Clone the old repository
Remove the old repository remote URL
Add the new remote repository URL,
push to the remote repository.
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.