2020-09-30 03:26:08 -07:00
|
|
|
---
|
|
|
|
|
eleventyNavigation:
|
|
|
|
|
key: CitableCode
|
|
|
|
|
title: Citable Code
|
|
|
|
|
parent: Collaborating
|
|
|
|
|
---
|
|
|
|
|
|
2025-06-14 02:38:21 -07:00
|
|
|
The easiest way to refer to your code is to send/post the URL of your repository.
|
|
|
|
|
However, if you need to reliably refer to a specific version of your code in the long run, for example for scientific
|
|
|
|
|
writing, this is not really viable, because URLs can change.
|
2025-12-18 17:12:14 -08:00
|
|
|
Another possibility is to download your repository as a ZIP or TAR.GZ archive (see section Clone in
|
|
|
|
|
[Clone & Commit via Web](/git/clone-commit-via-web)) and share this file.
|
2025-06-14 02:38:21 -07:00
|
|
|
The third option, which actually complements the second, is to assign a [Digital Object Identifier](https://www.doi.org/)
|
|
|
|
|
(DOI) to your code. Having a DOI for your code means that everybody can cite your code using this _standard_
|
|
|
|
|
and _permanent identifier_.
|
|
|
|
|
Assigning a DOI for citation is routine in the academic world.
|
2020-09-30 03:26:08 -07:00
|
|
|
|
|
|
|
|
This page will show you how to do just that. The process can be decomposed in four steps.
|
|
|
|
|
|
2021-08-09 02:59:36 -07:00
|
|
|
## Create a release of your repository
|
2024-06-11 00:51:22 -07:00
|
|
|
|
2025-06-14 02:38:21 -07:00
|
|
|
Creating a release is optional, but recommended. A release will make it clear what version of your code you want to share/cite.
|
|
|
|
|
Any further edits to your code will not be included in the release.
|
2025-12-18 17:12:14 -08:00
|
|
|
In other words, it's good practice to share/cite a release with fixed code rather than the always changing code of your
|
|
|
|
|
repository.
|
2021-08-20 01:27:58 -07:00
|
|
|
|
2021-09-24 06:57:18 -07:00
|
|
|
You can find instructions on the [Tags and Releases article](/git/using-tags/#creating-tags-and-releases).
|
2020-09-30 03:26:08 -07:00
|
|
|
|
|
|
|
|
## Download the ZIP archive
|
2024-06-11 00:51:22 -07:00
|
|
|
|
2025-06-14 02:38:21 -07:00
|
|
|
If you created a release, download the ZIP archive of the source code on the `Releases` tab of your repository,
|
|
|
|
|
as shown in the previous screenshot.
|
2020-09-30 03:26:08 -07:00
|
|
|
|
|
|
|
|
If not, you can simply download the ZIP archive of the repository (see section Clone in [Clone & Commit via Web](/git/clone-commit-via-web)).
|
|
|
|
|
|
|
|
|
|
## Upload the ZIP archive to an online repository
|
|
|
|
|
|
2025-06-14 02:38:21 -07:00
|
|
|
There are many online repositories made specifically for research, e.g. [Zenodo](https://zenodo.org/), [Figshare](https://figshare.com/),
|
|
|
|
|
[Dryad](https://datadryad.org/), and [OSF](https://osf.io/).
|
|
|
|
|
Others might be more appropriate for other uses.
|
2024-06-11 00:51:22 -07:00
|
|
|
|
2025-06-14 02:38:21 -07:00
|
|
|
Upload the ZIP archive to one of them, and follow the steps there to assign a DOI. Be sure that you add the URL of your
|
|
|
|
|
Codeberg repository in the information of the record on the online repository, so that everyone accessing the record can
|
|
|
|
|
easily find your Codeberg repository (and you!). In general, add as much information as applicable.
|
2020-09-30 03:26:08 -07:00
|
|
|
|
2023-11-26 21:45:00 -08:00
|
|
|
{% admonition "info" %}
|
|
|
|
|
|
2025-06-14 02:38:21 -07:00
|
|
|
It should be possible to write an integration between Codeberg and one of the DOI repositories to make citing code a lot
|
|
|
|
|
smoother. If you happen to be interested, you may want to have a look at [#295](https://codeberg.org/Codeberg/Community/issues/295).
|
2023-11-26 21:45:00 -08:00
|
|
|
|
|
|
|
|
{% endadmonition %}
|
2020-09-30 03:26:08 -07:00
|
|
|
|
|
|
|
|
## Share the DOI
|
2024-06-11 00:51:22 -07:00
|
|
|
|
2025-06-14 02:38:21 -07:00
|
|
|
Finally, get the DOI from the online repository.
|
|
|
|
|
This is the permanent URL you can share and use for citation in scientific writing.
|
2024-06-11 00:51:22 -07:00
|
|
|
|
2020-09-30 03:26:08 -07:00
|
|
|
A DOI has the form `https://doi.org/repoID/recordID`. It has three parts:
|
2024-06-11 00:51:22 -07:00
|
|
|
|
|
|
|
|
- `https://doi.org`, the _proxy_ is always there as is. It is sometimes omitted for compactness.
|
|
|
|
|
- `repoID`, the _prefix_ is specific to the online repository. Its format is usually `10.XXXX`.
|
|
|
|
|
- `recordID`, the _suffix_ identifies your record. Its format is specific to the online repository.
|