Topics Map > Electronic Lab Notebooks
LabArchives and Jupyter Notebook Migration: migrating your code to GitLab
Managing your code is a crucial step in making your research reproducible. Git is a version control system used for tracking changes in computer files. This allows researchers to version control their notebooks, collaborate with others, and manage work within GitLab, help them streamline their research workflows and manage their projects more effectively. It is generally used for source code like the code you created in Jupyter Notebooks, LabArchives, and other Electronic Research Notebooks. You can learn about the benefits of using git and managing your code with repositories here and here.
While there isn't a direct integration between LabArchives and GitLab, researchers can still use them together in their workflow. Researchers can manually export their data or files from LabArchives and then commit and push them to their GitLab repository. This allows researchers to track changes and collaborate with others using GitLab, while still keeping the data organized.
GitLab is a web-based Git repository that provides both public and private repositories. DoIT manages an instance of GitLab free of charge for campus researchers. However, if you are planning to leave campus, you can still get a free account with GitLab or Github. Both have generous licenses for individuals.
GitHub Version Control for Jupyter Notebooks
Qubole Data Service documentation:
1. Generating a Gitlab token in the GitLab Profile
- Navigate to Notebooks >> Jupyter and open a Jupyter notebook.
- From the left sidebar, click on the GitLab Versions icon.
- Click Configure now.
- In the dialog box add the generated GitLab token and click Save.
- The GitLab token is now configured for your account.
2. Linking Jupyter Notebooks to GitLab
- Navigate to the GitLab profile and copy the URL from the browser’s address bar.
- Navigate to Notebooks >> Jupyter and open a Jupyter notebook.
- From the left sidebar, click on the GitLab Versions icon.,
- Click the Link Now option.
- In the Link Notebook to GitLab dialog box, perform the following actions:
- Add the GitLab repository URL in the Repository Web URL text field. Ensure that the GitLab profile token has read permissions for the repository to checkout a commit and write permissions for the repository to push a commit.
- Select a branch from the Branch drop-down list.
- Add an object path file in the Object Path text field.
- If you want to strip the outputs from the notebooks before committing to GitLab, select the Strip Output checkbox.
- Click Save.
- Add the GitLab repository URL in the Repository Web URL text field. Ensure that the GitLab profile token has read permissions for the repository to checkout a commit and write permissions for the repository to push a commit.
GitLab - LabArchives
- Initialize a Git repository for your LabArchives project folder.
- Commit and push your file to the GitLab repository.
- Collaborators can then clone the repository, make changes to the files, and push their updates back to the GitLab repository.