Skip to main content

Git Auto Export Plugin

Version Compatibility

For this plugin’s compatibility with Open edX, see the Open edX Release Compatibility table.

Installation

For detailed installation instructions, please refer to the plugin installation guide.

Installation required in:

  • Studio (CMS)

Configuration

  • Enable the following FEATURES flags in the config file in Open edX. For any release after Juniper, that config file is /edx/etc/cms.yml. If you’re using private.py, you will need to enable these FEATURES in cms/envs/private.py.

    "FEATURES": {
        "ENABLE_EXPORT_GIT": true,
        "ENABLE_AUTO_GITHUB_REPO_CREATION": true  # Optional, to auto create github repo for new courses
    }
    # Set when ENABLE_AUTO_GITHUB_REPO_CREATION is true
    GITHUB_ORG_API_URL = "https://api.github.com/orgs/<GITHUB_ORG_NAME>"  # For GitHub Enterprise, change the URL accordingly
    GITHUB_ACCESS_TOKEN = "<GITHUB_PERSONAL_ACCESS_TOKEN>"  # Token must have 'repo - Full control of private repositories' permission
  • Set your commit user in cms/envs/common.py, if you don’t want to use the default one

    GIT_EXPORT_DEFAULT_IDENT = {
        'name': 'STUDIO_EXPORT_TO_GIT',
        'email': 'STUDIO_EXPORT_TO_GIT@example.com'
    }
  • Optionally route export tasks to their own Celery queue. Exports take tens of seconds, so on the default queue they hold up Studio’s short publish tasks. Unset, exports use edx-platform’s default routing. A worker must consume the queue, or exports wait there indefinitely. Repository creation stays on the default queue.

    GIT_AUTO_EXPORT_CELERY_QUEUE: "edx.cms.core.git_export"
  • Content with a Studio asset over GIT_AUTO_EXPORT_MAX_FILE_SIZE bytes is not exported, since GitHub rejects pushes containing a file over 100 MB. The check does not bound push memory: content under the limit is still pushed, so size the export worker for its largest courses. The default is GitHub’s limit; set it to null or 0 to turn the check off. The skipped export appears in the export history with the files named. To export the content, host those files elsewhere (for example S3) and link to them from the course; the next publish exports it. Files in v2 libraries are not checked.

    GIT_AUTO_EXPORT_MAX_FILE_SIZE: 104857600  # bytes
  • Restart the server using make studio-restart on Devstack or tutor dev/local restart openedx on Tutor.

  • For Tutor installations, these values can also be managed through a custom tutor plugin.

Setup github authentication for plugin

If you’re testing from a docker machine running devstack setup github authentication for plugin, you’ll need to generate SSH keys in that machine and add them to your Github account (https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ - https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account)

Studio/CMS UI settings

  • Open studio admin at /admin/ol_openedx_git_auto_export/contentgitrepository/

  • Add your course_id and in the GIT URL, add your OLX git repo. For example git@github.com:<GITHUB_USERNAME>/edx4edxlite.git.

  • Make a change to the course content and publish.
    • When using Tutor, attach with the CMS container using tutor dev/local start cms and enter yes to the prompt to add the GitHub to known hosts.

    • You should see a new commit in your OLX repo.

    • Commit user should be the one that published the change.

    • If user is not available, it should be the default one set in GIT_EXPORT_DEFAULT_IDENT.

  • Test commit count increase on your OLX repo.

Library Support

This plugin supports automatic git export for both courses and content libraries.

Library v1 (Legacy Libraries)

Library Key Format: library-v1:org+library

Supported Operations:

  • ✅ Auto-export on update: When you update/publish a library v1, changes are automatically exported to git

  • ✅ Auto-repo creation: Library v1 does NOT have a creation signal in Open edX, so the GitHub repository is automatically created on the first library update signal

Setup for Library v1:

  1. Enable the library feature flags in your config:

    "FEATURES": {
        "ENABLE_GIT_AUTO_LIBRARY_EXPORT": true,
        "ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION": true
    }
  2. Make changes to your library and publish

Library v2 (Content Libraries)

Library Key Format: lib:org:slug

Supported Operations:

  • ✅ Auto-export on update: When you update a library v2, changes are automatically exported to git

  • ✅ Auto-repo creation: When you create a new library v2, a GitHub repository can be automatically created

Setup for Library v2:

  1. Enable the library feature flags in your config:

    "FEATURES": {
        "ENABLE_GIT_AUTO_LIBRARY_EXPORT": true,
        "ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION": true
    }
  2. When creating a new library v2, if ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION is enabled, a GitHub repository will be created automatically

  3. Updates to the library will be automatically exported to git

Important Notes:

  • Library v1 does not emit a creation signal, so the GitHub repository is automatically created on the first library update

  • Library v2 uses the new event architecture and supports both creation and update signals for immediate repository creation

  • Both library types support automatic git export on updates once configured

Export History

Every export that runs adds a row to Content Git Export Logs in Django admin (/admin/ol_openedx_git_auto_export/contentgitexportlog/): its status, author, Celery task id, a log of its steps with UTC times (each git command and the content export, as they start), and, on failure, the error with its traceback and git’s own output. Failed GitHub repository creations are recorded there too. The Content Git Repositories list shows each row’s latest status and time. The user and password in an http(s) git URL are stored as ***.

The row is created as In progress when the export starts and updated as it goes. A worker killed mid-export (out of memory, the time limit, a restart) leaves it In progress until the next export of the same content marks it Failed. Until then, a “modified” time more than 10 minutes old (the export time limit) means the run is dead. The last line of its log is the last step it started; an empty log means it died before the export itself began, while loading the content.

Runs that are merged into a later one, or wait for another export of the same content, add no row; the run that finally exports does. A wait that cannot re-queue itself is recorded as Failed. Rows are kept indefinitely; only superusers can delete them from the admin.

Re-exporting Without a Publish

Courses are exported only when published and libraries only when updated, so content whose export failed stays stale in git until its next change. A failed export fails its Celery task, so it shows in task metrics; it is not retried. To queue an export on demand, fix whatever made the export fail, then use either:

  • The Export selected content to git action on the Content Git Repositories page in Django admin.

  • The export_to_git management command:

    # Specific courses or libraries
    ./manage.py cms export_to_git --content-keys course-v1:MITx+6.00x+2T2024 lib:MITx:mylib
    
    # Every repository with export enabled; --dry-run lists without queueing
    ./manage.py cms export_to_git --all --dry-run

Both skip, and report, content that no longer exists and content whose auto-export settings (ENABLE_EXPORT_GIT plus the course or library flag) are off, and report content whose export could not be queued. The admin action and --content-keys also skip rows with is_export_enabled off, while --all only considers rows with it on. The command also reports keys with no repository, and exits non-zero if any key errored or, with --content-keys, if any named key was skipped. Exports go through the same debounce as publish-triggered ones: a request made during a pending export’s 5-second countdown is merged into it, but one made after that export has started queues another.

How Exports Are Scheduled

  • A burst of publish signals for one course or library becomes one export, which runs once no signal has arrived for 5 seconds. A burst that keeps going is exported anyway every 10 minutes.

  • Exports of the same course or library wait for each other, since they share one clone directory. An export queued while another is running waits for it, then exports whatever changed since.

  • An export is killed after 10 minutes. Removing a .git/index.lock left by a killed export waits until the lock is a minute old.

Metadata

Release files for ol-openedx-git-auto-export 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ol-openedx-git-auto-export 0.14.0
File Size Uploaded Provenance Actions
ol_openedx_git_auto_export-0.14.0.tar.gz 31.9 kB Without provenance Details for ol_openedx_git_auto_export-0.14.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ol-openedx-git-auto-export 0.14.0
File Interpreter ABI Platform Actions
ol_openedx_git_auto_export-0.14.0-py3-none-any.whl Python 3 none any Details for ol_openedx_git_auto_export-0.14.0-py3-none-any.whl

Total release size: 71.9 kB

Release files / ol_openedx_git_auto_export-0.14.0.tar.gz

Download URL ol_openedx_git_auto_export-0.14.0.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6e3dcd8285767f342f38e8b56507832b1e0f470a3580f32d0d64d054d36e35d3
BLAKE2b-256 checksum
How to use checksums
8b491be068d9fa0f69a2a3c387bd739d143a8e4f8b6235224c352ccb539b666d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / ol_openedx_git_auto_export-0.14.0-py3-none-any.whl

Download URL ol_openedx_git_auto_export-0.14.0-py3-none-any.whl
Size 39.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dadf6b347b71570dfc5d778661e4f150ed1010e157b80e328d2f950a56bc45f8
BLAKE2b-256 checksum
How to use checksums
a62545feaf0d8de96e86111ef73a6e1eb49408a1a3859c85a0202e43e7b6457f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for ol-openedx-git-auto-export 0.14.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page