This project is not covered by Drupal’s security advisory policy.

Connect your Drupal site to GitHub and GitLab: add a read-only token for each host once, and modules such as Git Field can read repositories, files and releases from it.

Git Host reads from github.com, GitHub Enterprise (Cloud with data residency, such as example.ghe.com, and Server), gitlab.com and self-managed GitLab. It keeps each host's token in a Key module key, sends it only to that host, and caches the hosts' responses for an hour. It has no user interface of its own: other modules use it.

Features

  • A "Git host token" key type, with the provider and host each token belongs to.
  • A git_host.api service that reads a repository's files, published releases and protected branches, and any other API endpoint, from any host with a key or a public host. It caches successful responses for an hour, and reads up to 1,000 items of a list.
  • Git provider plugins for GitHub and GitLab, which other modules can add to.

Developers: see Using the API.

Post-Installation

Public repositories on github.com and gitlab.com work without any setup, with the hosts' lower rate limits for requests without a token. For other hosts and private repositories:

  1. Create a read-only token for the host:
  2. Add the token as a key at Configuration > System > Keys (/admin/config/system/keys), with the "Git host token" key type. Choose the provider (GitHub or GitLab) and enter the host name only, such as github.com, example.ghe.com or gitlab.example.com. Each host can have one key. Key's providers keep the token out of the site's exported configuration: for example, the "Environment" provider reads it from an environment variable.

Additional Requirements

This module requires the Key module, which stores the tokens for each host.

Modules that use Git Host

  • Git Field: a field for Git repositories, with formatters that show data from them, and a dashboard of the sites you look after.
Supporting organizations: 
Development

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • Project categories: Developer tools, Integrations
  • Created by dave reid on , updated
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.

Releases