---
title: "Export Config: Code Studio to GitLab"
date: "2022-04-26T15:56:38+00:00"
summary:
image:
type: "article"
url: "/acquia-cloud-platform/add-ons/code-studio/help/88551-export-config-code-studio-gitlab"
id: "226a35db-e0a3-4ea2-b484-c0ddc0a6cfa6"
---

Table of contents will be added

Goal
----

Integrate Code Studio with your Drupal site so you can create a merge request with updated config with the click of a button.

Prerequisites
-------------

*   Acquia Code Studio or GitLab
    
*   Drupal 8/9/10
    

Overview
--------

Sometimes, you gotta make config changes in production. Getting those changes back into code requires jumping through a few hoops. You'd typically need to copy the production database into a writable environment, export the configuration, commit it, and push it back upstream.

Not anymore. With Acquia Code Studio (powered by GitLab) and one handy contributed model, you can now revise that process to be a simple button click. Not database copying, local export, no local commit.

Here's how.

1.  Install the config\_patch\_gitlab\_api module.
    ----------------------------------------------
    
         composer require drupal/config_patch_gitlab_api
    
    Note
    
    If you are using Acquia Search or Geocoder modules, then you may have a composer dependency issue. There is an issue open for that, and until that is closed, you may need to use the issue fork: “drupal/config\_patch\_gitlab\_api”: “dev-3259230-update-to-php-httpguzzle6-adapter”,
    
2.  Enable the module
    -----------------
    
    Use the UI to enable the module, or use Drush:
    
         drush en config_patch_gitlab_api
    
3.  Create a GitLab project access token
    ------------------------------------
    
    Log into Code Studio, and open the project you are connecting to.
    
    In the Settings menu choose Access Tokens. Choose a name and optional expiry date for the token. Be sure to grant at least the `api` and `write_repository` scopes. Then click the Create project access token button.
    
    ![Screenshot of a GitLab interface showing "Project Access Tokens" setup, including fields for token name, expiration date, role selection, and scopes.](https://acquia.widen.net/content/rjqlvyv1yx/web/devportal_jwAAAABJRU.png?v=f2e78f00-413e-496c-ac0b-5a59d49cae12)
    
    Be sure to save the project access token somewhere safe. Once you leave or refresh  
    the page, you don't have access to it again.
    
4.  Set configuration values
    ------------------------
    
    Configure your site to connect to Code Studio on the following paths:
    
    *   Put in your token `/admin/config/config_patch_gitlab_api/credentials`  
        
        ![Configuration page for GitLab API credentials with fields for URL and token, and a "Save configuration" button.](https://acquia.widen.net/content/fvcj0k7aeu/web/devportal_8wAAAABJRU.png?v=706a1503-c257-4e5d-aa91-6561c44d554a)
        
    *   Choose the branch that you will create a MR for: `/admin/config/config_patch_gitlab_api/project_branch`  
        
        ![Configuration page for GitLab API with dropdowns for project and branch selection, and a "Save configuration" button.](https://acquia.widen.net/content/f00fcggy4h/web/devportal_RQAAAABJRU.png?v=dcd6b779-3f30-4a2a-9037-71e4013a4827)
        
    *   Adjust the other settings `/admin/config/development/config_patch`  
        
        ![Config Patch Settings page with options for base path, output plugin, and config filtering. Includes "Save configuration" button.](https://acquia.widen.net/content/4eh2i2grr0/web/devportal_CkpkAAAAAE.png?v=d577c37d-a2d6-42c8-ab54-a079b8cac99d)
        
5.  Export your configuration to Code Studio
    ----------------------------------------
    
    Once a configuration change has been made, you'll see a "Config changes" item in your toolbar with a number representing the number of config changes. Click on that item to visit the "Config patch" page.
    
    ![Website interface with a blue banner reading "Built for Developers, by Developers." Navigation bar includes options like Products, Topics, and Resources.](https://acquia.widen.net/content/aiciypofn5/web/devportal_2cAAAAAASU.png?v=5cb71721-cf55-4e99-aa9f-972c876da48b)
    
    Next, write the commit message for the Merge Request that will be created in Code Studio, select the config to export, and click "Create GitLab merge request."
    
    ![Interface for creating a GitLab merge request, showing commit message, config items to export, and a button to create the request.](https://acquia.widen.net/content/nmfk7xuuon/web/devportal_1wAAAABJRU.png?v=8cb05116-850c-4f7e-9ed1-6683e4c3879f)
    
    That's it! You now have an open merge request that introduces the config changes that are present on your live Drupal site.
    
    Acquia Code Studio's AutoDevOps will test your changes and even deploy them to a Continuous Delivery Environment where you can review and validate.
    

Additional Resources
--------------------

*   [Create a project access token (GitLab)](https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html)
*   [Issue: Update to php-http/guzzle6-adapter 2.x](https://www.drupal.org/project/config_patch_gitlab_api/issues/3259230)