It's simple, just follow the steps:)
1. Inside your GitHub team page, create an empty private repo with the same name of Bitbucket/GitLab
repo that you want to transfer.
2. Copy your newly created repo link, either in HTTPS or SSH.
For example, git@github.com:team-name/repo-name.git (SSH type)
3. Inside your local project folder, change the remote URL under.git/config ‘s file to your copied
GitHub's
one. The content looks similar as follows. [remote "origin"]
url = git@github.com:team-name/repo-name.git
fetch = +refs/heads/*:refs/remotes/origin/*
4. Do a git push: git push --all . It will push all codes and commit history on your newly GitHub
repository.
5. Done. After that, when we push new commits, it will push to GitHub only.
6. The Bitbucket/GitLab repo now can be archived to ‘Read-only’ mode.
You can do the migration with the git cli:
1) Mirror the Gitlab repo to your local machine (git clone --mirror )
2) Move to your repo (cd )
3) Remove remote repo (git remote remove origin)
4) Create Repo in github via web interface
5) Add new remote repo (git remote add origin )
6) Push to github (git push origin --mirror)
For the Jenkins integration you can use ssh deploy keys:
1) Create a deploy key (ssh-keygen -t rsa)
2) Add public key to Github (Settings → Deploy Keys)
3) Add private key to Jenkins (Add credentials → ssh username with private key)
4) Select the github repo ssh url and the created credentials within the Jenkins job
After some research I found a description here https://docs.github.com/en/actions/migrating-to-github-actions/migrating..., but your steps are much simpler and clearer, thanks for sharing!
Thanks for bringing up this useful case. I found the solution for the opposite case GitHub to GitLab as well :-) https://linuxkamarada.com/en/2021/06/25/how-to-migrate-projects-from-git...
Comments