Hands-on: Hook up with an GIT repository
Last updated on
30 April 2025
For git you need the "GIT backend" module.
Here is an example of using GIT backend:
Step 1: create an bare GIT repository (skip this if you already have one)
mkdir bare.git
cd bare.git
git init --bareStep 2: set up your Drupal site with that repository
- Enable the "Version Control API", "Commit Log" and "GIT backend" modules.
- Flush cache.
- Assign role permissions for for "Administer version control systems"
(by default nobody has any permissions) - Go to Configuration > Development > Version Control settings
(url: /admin/config/development/versioncontrol-settings) - Set "Git binary path".
(Notice: Can be problems with Windows OS. On *nix OS there are no problems with path) - Go to Content > VCS repositories > Add Git repository in the admin area.
(url: /admin/content/versioncontrol-repositories/add-git)- Repository name: "Test repo", or whatever.
- Repository root: "/path/to/repository/bare.git".
- Web viewer URL handler: check because by default it's not set.
(Might it'll be fixed in closest time) - For other settings follow fields descriptions
- Save the repository.
- Enable the "Commit messages" menu entry, or go directly to the "/commitlog" path.
- The commit shows up there and the message log will be updated on every cron run.
Step 3: clone bare GIT repository
git clone /path/to/repository/bare.git testrepo
cd testrepo
git "test" > 1.txt
git add .
git commit -m "initial commit"
git push
visit "/commitlog" page and watch commits
The commit shows up there and the message log will be updated on every cron run.
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion