OSCR

Leaving the registry

Your repository is already in your own GitHub account: leaving OSCR moves nothing and deletes nothing on GitHub. What OSCR keeps is a layer around it (the papers it is linked to, tracing maps, script copies under licences that allow it), and you can take that with you too.

From the repository's page on OSCR, under Settings: unlink it from its papers (one authorized action, as you, on GitHub), or ask for its layer to be deleted. The layer then leaves the site after a grace period of 30 days during which you can change your mind. Deleting the repository on GitHub itself stays your own act, on GitHub or from the same page, with a fresh authorization: OSCR never does it for you. Script copies and tracing maps of a paper are removed with a removal request, from the paper's own page.

A complete backup with git

A mirror clone holds every branch, tag and commit; a bundle puts all of it in one file you can keep anywhere and clone from later. OWNER is your account, NAME the repository:

git clone --mirror 'https://github.com/OWNER/NAME.git' 'NAME.git'
cd 'NAME.git'
git bundle create '../NAME.bundle' --all
cd ..
git bundle verify 'NAME.bundle'
# To restore: clone the bundle, then push it to a new empty repository.
git clone 'NAME.bundle' 'NAME-restored'

With Git LFS, its large files are fetched into the mirror too (they are not in the bundle: keep the folder):

git clone --mirror 'https://github.com/OWNER/NAME.git' 'NAME.git'
cd 'NAME.git'
git lfs fetch --all origin
git bundle create '../NAME.bundle' --all
cd ..
git bundle verify 'NAME.bundle'
# To restore: clone the bundle, then push it to a new empty repository.
git clone 'NAME.bundle' 'NAME-restored'

Issues, pull requests and the rest: GitHub's migration archive

Git keeps the code and its history; the issues, pull requests, comments, releases and wiki are GitHub's metadata. GitHub exports them as a migration archive (the user migrations API), here withGitHub's command-line tool and your own sign-in. The repository is not locked while it is prepared. Options leave out the Git data, the metadata, attachments, releases or projects when you do not need them (exclude_… set to true).

MIGRATION_ID=$(gh api --method POST /user/migrations -f 'repositories[]=OWNER/NAME' -F lock_repositories=false -F exclude_git_data=false -F exclude_metadata=false -F exclude_attachments=false -F exclude_releases=false -F exclude_owner_projects=false --jq .id)
# Its state: pending, exporting, exported or failed. Wait for exported:
gh api "/user/migrations/$MIGRATION_ID" --jq .state
gh api "/user/migrations/$MIGRATION_ID/archive" > 'NAME-migration.tar.gz'

The registry's layer

Everything OSCR shows publicly about a repository comes from its public files: the form above saves it as one JSON file, made in your browser. Tracing maps validated by an author have their own DOI on Zenodo, and stay citable wherever the code goes.

A citable copy

A DOI for a release of the code itself comes from an archive, not from a host:Zenodo's GitHub integration orfigshare's archive each release you publish on GitHub, with its own DOI.

Restoring from Software Heritage

Software Heritage keeps public code for the long term; OSCR asks it to save a repository when a person asks. A history it holds can be restored into an empty repository through itsvault: replace the identifier below (swh:1:rev:…) by the one Software Heritage shows for the commit, and NAME-restored by the empty repository you created.

# Ask the archive to prepare it (once), then ask again until its status is done:
curl -X POST 'https://archive.softwareheritage.org/api/1/vault/git-bare/swh:1:rev:0000000000000000000000000000000000000000/'
curl 'https://archive.softwareheritage.org/api/1/vault/git-bare/swh:1:rev:0000000000000000000000000000000000000000/'
curl -L --fail -o restore.tar.gz 'https://archive.softwareheritage.org/api/1/vault/git-bare/swh:1:rev:0000000000000000000000000000000000000000/raw/'
mkdir restore
tar -xzf restore.tar.gz -C restore
cd restore/*
git log --oneline -3
git push --mirror 'https://github.com/OWNER/NAME-restored.git'

More