... | ... | @@ -3,87 +3,97 @@ title: Migrate GitLab projects and groups from Forgemia to Cirad |
|
|
---
|
|
|
- Re-create groups at Cirad
|
|
|
- For each group
|
|
|
- Transcribe group parameters
|
|
|
- Group Description
|
|
|
- Group Avatar
|
|
|
-
|
|
|
- Transcribe group parameters
|
|
|
- Group Description
|
|
|
- Group Avatar
|
|
|
- For each project in Forgemia
|
|
|
- Export project and download export file (`Settings > General > Advanced`)
|
|
|
- Import project from file in Cirad (`New Project > Import > From GitLab export`)
|
|
|
- Transcribe project parameters that were not exported
|
|
|
- Projec avatar
|
|
|
- Project topics (tags and keywords) - no accents allowed in Cirad
|
|
|
- Deprecate the Forgemia repo
|
|
|
- Edit the project description to: `This repository moved to <url>`
|
|
|
- Archive the project (`Settings > General > Advanced > Archive project`)
|
|
|
- Update the URLs in the local repository
|
|
|
- Rename the old origin
|
|
|
|
|
|
```bash
|
|
|
git remote rename origin old-origin
|
|
|
```
|
|
|
- Declare the new remote repository and make sure it's up to date in all branches:
|
|
|
|
|
|
```bash
|
|
|
git remote add origin git@gitlab.cirad.fr:2022/astre/<projectname>.git
|
|
|
git push -u origin --all
|
|
|
git push -u origin --tags
|
|
|
```
|
|
|
- **If the project is a R package**
|
|
|
- Fix URLs in package files
|
|
|
|
|
|
```bash
|
|
|
sed -i 's/umr-astre\.pages\.mia\.inra\.fr/astre\.gitlab\.cirad\.fr/g' DESCRIPTION
|
|
|
sed -i 's/forgemia.inra.fr\/umr-astre/gitlab\.cirad\.fr\/astre/g' DESCRIPTION
|
|
|
sed -i 's/install_github("Cirad-ASTRE\/<projectname>")/install_gitlab("astre\/<projectname>", host = "gitlab.cirad.fr")/g' README.Rmd
|
|
|
```
|
|
|
- Update package web site
|
|
|
|
|
|
```bash
|
|
|
Rscript -e "pkgdown::build_site()"
|
|
|
```
|
|
|
- Push changes
|
|
|
|
|
|
```bash
|
|
|
git add .
|
|
|
git commit -m "Migrate to Cirad"
|
|
|
git push
|
|
|
```
|
|
|
- **If GitLab pages is enabled**
|
|
|
- Create a new tracking branch off `old-origin/main` (or `master`)
|
|
|
|
|
|
```bash
|
|
|
git checkout -b deprecate-forgemia --track old-origin/main
|
|
|
```
|
|
|
- Substitute the contents of `public/index.html` with:
|
|
|
|
|
|
```html
|
|
|
<!DOCTYPE html>
|
|
|
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
|
|
|
<head>
|
|
|
<meta http-equiv="Refresh" content="0; url='https://astre.gitlab.cirad.fr/<projectname>/'">
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
<meta charset="utf-8">
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>Redirect to new website</title>
|
|
|
- </head>
|
|
|
<body>
|
|
|
- This site moved to <a href="https://astre.gitlab.cirad.fr/<projectname>/">https://umr-astre.pages.mia.inra.fr/<projectname>/</a>
|
|
|
- </body>
|
|
|
</html>
|
|
|
```
|
|
|
- Push changes
|
|
|
|
|
|
```bash
|
|
|
git add .
|
|
|
git commit -m "Migrate to Forgemia"
|
|
|
git push -f --set-upstream old-origin deprecate-github:master
|
|
|
```
|
|
|
- Revert to branch `main`
|
|
|
|
|
|
```bash
|
|
|
git checkout main
|
|
|
```
|
|
|
- **If alternative CI/CD systems (Travis-CI, Appveyor) are in use**
|
|
|
- Update the continuous integration systems of the repository |
|
|
\ No newline at end of file |
|
|
- Export project and download export file (`Settings > General > Advanced`)
|
|
|
- Alternatively, make a direct transfer
|
|
|
- This is possible for public projects.
|
|
|
- For private or internal projects you need the user name and a PAT
|
|
|
`famuvie Mfrk3upQH1jVnyeNpjzF`
|
|
|
- Import project from file in Cirad (`New Project > Import > From GitLab export`)
|
|
|
- Transcribe project parameters that were not exported
|
|
|
- Projec avatar
|
|
|
- Project topics (tags and keywords) - no accents allowed in Cirad
|
|
|
- Deprecate the Forgemia repo
|
|
|
- Edit the project description to:
|
|
|
`This repository moved to <url>`
|
|
|
- Archive the project (`Settings > General > Advanced > Archive project`)
|
|
|
- Update the URLs in the local repository
|
|
|
- Rename the old origin
|
|
|
```bash
|
|
|
git remote rename origin old-origin
|
|
|
```
|
|
|
- Declare the new remote repository and make sure it's up to date in all branches:
|
|
|
```bash
|
|
|
git remote add origin ssh://git@gitlab.cirad.fr:2022/astre/<projectname>.git
|
|
|
git branch -m master main # if the main branch is still called 'master'
|
|
|
git push -u origin --all
|
|
|
git push -u origin --tags
|
|
|
```
|
|
|
- Notice the explicit specification of the protocol `ssh://` before the URL. I've found that Cirad's GitLab fails to correctly parse the custom port specification in the URL, and some git commands (like push) incorrectly try to use the standard port 22. This problem vanishes when explicitly setting the protocol in the URL.
|
|
|
Thanks to DeepSeek:
|
|
|
> The SCP-like syntax (git@host:path) is a shorthand for SSH URLs, but it has limitations when custom ports or complex paths are involved. The ssh:// protocol is more explicit and avoids ambiguity, ensuring Git handles the connection correctly.
|
|
|
- I've also seen the suggestion to specify the port in `~/.ssh/config` file as:
|
|
|
```bash
|
|
|
Host gitlab.cirad.fr
|
|
|
HostName gitlab.cirad.fr
|
|
|
Port 2022
|
|
|
User git
|
|
|
```
|
|
|
But I think it is not necessary.
|
|
|
- __If the project is a R package__
|
|
|
collapsed:: true
|
|
|
- Fix URLs in package files
|
|
|
```bash
|
|
|
sed -i 's/umr-astre\.pages\.mia\.inra\.fr/astre\.gitlab\.cirad\.fr/g' DESCRIPTION
|
|
|
sed -i 's/forgemia.inra.fr\/umr-astre/gitlab\.cirad\.fr\/astre/g' DESCRIPTION
|
|
|
sed -i 's/install_github("Cirad-ASTRE\/<projectname>")/install_gitlab("astre\/<projectname>", host = "gitlab.cirad.fr")/g' README.Rmd
|
|
|
```
|
|
|
- Update package web site
|
|
|
```bash
|
|
|
Rscript -e "pkgdown::build_site()"
|
|
|
```
|
|
|
- Push changes
|
|
|
```bash
|
|
|
git add .
|
|
|
git commit -m "Migrate to Cirad"
|
|
|
git push
|
|
|
```
|
|
|
- __If GitLab pages is enabled__
|
|
|
collapsed:: true
|
|
|
- Create a new tracking branch off `old-origin/main` (or `master`)
|
|
|
```bash
|
|
|
git checkout -b deprecate-forgemia --track old-origin/main
|
|
|
```
|
|
|
- Substitute the contents of `public/index.html` with:
|
|
|
```html
|
|
|
<!DOCTYPE html>
|
|
|
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
|
|
|
<head>
|
|
|
<meta http-equiv="Refresh" content="0; url='https://astre.gitlab.cirad.fr/<projectname>/'">
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
<meta charset="utf-8">
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>Redirect to new website</title>
|
|
|
- </head>
|
|
|
<body>
|
|
|
- This site moved to <a href="https://astre.gitlab.cirad.fr/<projectname>/">https://umr-astre.pages.mia.inra.fr/<projectname>/</a>
|
|
|
- </body>
|
|
|
</html>
|
|
|
```
|
|
|
- Push changes
|
|
|
```bash
|
|
|
git add .
|
|
|
git commit -m "Migrate to Forgemia"
|
|
|
git push -f --set-upstream old-origin deprecate-github:master
|
|
|
```
|
|
|
- Revert to branch `main`
|
|
|
```bash
|
|
|
git checkout main
|
|
|
```
|
|
|
- __If alternative CI/CD systems (Travis-CI, Appveyor) are in use__
|
|
|
collapsed:: true
|
|
|
- Update the continuous integration systems of the repository |
|
|
\ No newline at end of file |