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.apiservice 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:
- Create a read-only token for the host:
- On GitHub, a fine-grained personal access token with read-only access to the repository permissions the modules you use need, such as Contents.
- On GitLab, a personal, group or project access token with the
read_apiscope.
- 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 asgithub.com,example.ghe.comorgitlab.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.
Recommended modules/libraries
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.
Ask your assistant about Git Host
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.x-dev | Dev | 11 | Dec 1, 2026 |