Versioning Strategies

Assigning DOIs to GitLab Repositories

< >

Assigning DOIs to GitLab Repositories

GitLab does not natively support DOI creation, but services like Zenodo can assign DOIs by integrating with GitLab repositories. The process involves archiving a version of your code and registering it with Zenodo to obtain a persistent identifier.


Step 1: Create a release in GitLab and upload an archive (e.g., ZIP file) of the code.

You can find the “Releases” Section when expanding the “Deploy” Header from your project page.

  • Navigate to your repository on GitLab.
  • Go to “Releases” > “New Release”, tag it with a version number (e.g., v1.0), and attach the ZIP archive of your project.

GitLab release page showing a created release entry.

Step 2: Use Zenodo’s API or manual process to register the archive and obtain a DOI.

Zenodo login page with sign-in options.

  • Log in with your preferred way

Zenodo dashboard with the New Upload button highlighted.

  • Create a new Upload (upper right corner)

Zenodo new upload form for adding metadata and files.

  • Upload the ZIP file to Zenodo via its web interface or API.
  • Choose whenever you already have a DOI for the Project in our case No
    • Assign metadata (e.g., title, description, author) and generate a DOI for the release.

Zenodo upload form field for adding the repository URL.

  • Add the Repository URL to git.nrw
  • Copy the DOI provided by Zenodo (e.g., 10.5281/zenodo.1234567).
  • Add the DOI badge or link to your GitLab project’s README.md or wiki:
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1234567.svg)](https://doi.org/10.5281/zenodo.1234567)

git.nrw project settings page in GitLab.

  • Go to Project settings

GitLab badges section with option to add a new badge.

  • Click on new Badges

GitLab form for creating a new project badge.

  • Fill out the Link to the DOI
  • Fill DOI into “https://zenodo.org/badge/DOI/<YOUR-DOI-HERE>.svg”

Project overview page displaying the DOI badge on git.nrw.

Alternative: Using unofficial script to connect to Zenodo

If you want to automate the process of assigning DOIs to your GitLab releases, you can use the unofficial script gitlab2zenodo . This script helps you connect your GitLab repository with Zenodo, making DOI assignment easier and more reproducible.

Guide externally:

Sacha Beniamine: gitlab2zenodo

Note:

This script is unofficial and not maintained by GitLab or Zenodo.

Please review the script and its documentation for updates and security best practices.

Alternative: Using GitHub mirrors with Zenodo integration

If you prefer using official plugins, you can mirror your GitLab repository to GitHub and use the Zenodo integration available there. This allows you to create a DOI for your GitLab repository by leveraging GitHub’s DOI generation capabilities.

Guide externally:

Overview by Hamburg University of Technology In depth guide by Hamburg University of Technology

Source and Further Reading

This guide is based on the following source: