---
title: "GIT Deployment"
canonical: "https://docs.vaultspeed.com/space/VPD/3013148700/GIT%20Deployment"
format: markdown
---
VaultSpeed enables seamless **GIT-based deployments** for **GitHub, Azure DevOps, and Bitbucket**, allowing teams to automate the deployment of generated code.

With **dynamic branch selection**, you can now choose a target branch during deployment directly in the **VaultSpeed UI**, eliminating the need to predefine it in `connections.properties`.

This guide walks you through the **setup process, branch selection, execution, and troubleshooting** to ensure a smooth GIT deployment experience.


**Table of Contents**

> Macro (toc)

## GIT Deployment Process

### Automatic Deployment Setup

To deploy generated code to GIT:

1. Navigate to **Automatic Deployment** in VaultSpeed.
2. Select a **generation**.
3. Click **Generate**, then select **GIT** as the deployment target.
4. **Enter a connection name**. *(Optional)* **Specify a target branch name** if you want to deploy to a specific branch. If no branch is provided, the deployment will use the **current branch** of the local repository.
5. Click **Deploy** to start the process.

## Connection Configuration in connections.properties

Setting up the GIT connection in the connections.properties file of the VaultSpeed Agent requires the following properties:

- `<connection_name>.repo`: Path to the repository directory containing the .git file.
- `<connection_name>.target_dir`: Folder within the repository where generated code should reside. Maintain the same folder structure as the zip.
- `<connection_name>.commit_msg`: Commit message template:
  - `{code_type}`: ETL, DDL, FMC, or COMP.
  - `{id}`: Generation ID (from the zip file name).
  - `{info}`: Generation information, excluding the logo, is placed at the top of generated files.
- `<connection_name>.overwrite`: Optional (default: false).
  - `false`: Adds a delta ID to file names of delta generations to prevent overwriting existing files.
  - `true`: Overwrites files from older generations with new ones.
- `<connection_name>.user`: Optional. Set to your username for authentication. Alternatively, use an authentication token. For SSH-based authentication, skip this parameter.
- `<connection_name>.password`: Optional. Set to your password for username and password authentication.

See [Storing Connections | File (default)](https://docs.vaultspeed.com/space/VPD/3291381934/Storing+connections#File-(default)) for more information on configuring agent connections.

### Example Configuration

```
git_conn.repo = /home/user/repo
git_conn.target_dir = vaultspeed
git_conn.commit_msg = "Vaultspeed {code_type} generation ({id})\n\n{info}"
git_conn.overwrite = false
git_conn.user = ...
git_conn.password = ...
```

## Dynamic Branch Configuration for GIT Deployments

VaultSpeed now allows users to dynamically specify the deployment target branch directly from the VaultSpeed UI during GIT deployments.

- **Default Behavior**:  
If no branch name is provided, VaultSpeed will deploy to the currently checked-out branch in the repository.
- **Error Handling**:  
If the specified branch **does not exist **in the remote repository, VaultSpeed will display a clear error message, prompting you to **verify the branch name or create it if necessary**.

### How to Deploy to a Specific Branch

VaultSpeed now allows users to **dynamically specify the target branch** when deploying to GIT, eliminating the need to define it in `connections.properties`.

- **Go to the Automatic Deployment menu** in the VaultSpeed UI.
- **Select "GIT"** as the deployment target.
- **Enter the connection name** (e.g., `mygitconnection1`), which must match a connection defined in `connections.properties`.
- **(Optional) Enter a branch name** if you want to deploy to a specific branch.
  - **If no branch is specified,** VaultSpeed deploys to the currently checked-out branch in the repository.
  - **If a branch is specified,** the code will be deployed to that branch.
- **Click "Deploy"** to start the process.

> 📝 **Note**: The target branch is selected during deployment **and is not a saved setting.**

![Screenshot 2024-12-18 at 20.04.55.png](media://291435ba-16a8-4c31-bf9b-fa156f282598)

> 📝 ### **Key Notes for Users**
> 📝 
> 📝 - **Deploying to Another Branch:** You can deploy to **any branch**, even if it is **not** the currently checked-out branch.
> 📝 - **Error Handling:** If the branch does not exist, VaultSpeed will display this error message:
> 📝   - **Error:** Target branch `<branch_name>` does not exist. (Ensure the branch is available in the remote repository and try again).

#### **How to Fix This Error**

If deployment fails due to a missing branch, follow these steps:

1. **Double-check the branch name **for typos.
2. **Confirm the branch exists **in the remote Git repository.
3. **If needed, manually create the branch **before retrying the deployment.

> ℹ️ **Reminder:** If no branch is specified, VaultSpeed **automatically deploys to the currently checked-out branch**, so ensure you're on the right branch before deployment.

### Benefits of Configuring a Target Branch

- **Streamlines deployments** → *"Eases team workflows by streamlining deployments to specific branches."*
- **Reduces reliance** → *"Eliminates the need for static configuration settings like *`connections.properties`*."*

#### Git Committer and File Renaming

- **Git Committer Information**: The committer details in Git will appear as follows:
  - **Username**: "vaultspeed"
  - **Email**: "[info@vaultspeed.com](mailto:info@vaultspeed.com)"

> 📝 **File Naming Convention**: During deployment, the system automatically removes generation-specific data from file names, specifically removing the ID and generation timestamp from DDL and FMC files. Here's an illustration:
> 📝 
> 📝 - **Original FMC file**: `2428_FL_DAG_INCR_PRT_20220929_123337.py`
> 📝   - **Renamed to**: `FL_DAG_INCR_PRT.py`
> 📝 - **Original ETL file**: `4_310_001_ext_sls_payments_incr.sql`
> 📝   - **Renamed to**: `310_001_ext_sls_payments_incr.sql`

1. **Handling Special Characters in Paths and Usernames:**
  - **Tip:** Enclose paths, usernames, etc., containing special characters (like spaces, underscores, or dashes) within double quotes. Example: `"My USER-Name"`
2. **GitHub Deployment on AWS:**
  - **Important for GitHub on AWS:** Ensure that the relative path for `target_dir` concludes with a '/' (slash) during deployment.
3. **Delta Generations and File Naming:**
  - **For Delta Generations:** If the `overwrite` property of the connection is set to False or unspecified, the ID of the production release initiating the comparison will prefix file names.
4. **Setting GIT Repository for Committing Code:**
  - **Note:** The GIT repository must be aligned with a tracked branch where you intend to commit the code.

## Deploying to Different Platforms

### Deploying to GitHub

To deploy to GitHub, start by creating a Personal Access Token (PAT) for GitHub authentication. Refer to the  [GitHub PAT Documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) for detailed instructions.

> 📝 **Reminder:** When deploying to **GitHub, Azure DevOps, or Bitbucket**, you can now **dynamically select the target branch** in the VaultSpeed UI instead of predefining it in `connections.properties`.

See [Dynamic Branch Configuration for GIT Deployments](https://docs.vaultspeed.com/space/VPD/3013148700/GIT+Deployment#Dynamic-Branch-Configuration-for-GIT-Deployments) for **step-by-step instructions** on how to specify a branch.

The PAT requires `gist`, `read:org`, `repo`, and `workflow.` These permissions are essential for the successful deployment of your code.

Next, in your VaultSpeed Agent configuration, set up the connection with the following properties:

- `<connection_name>.repo`: Specify the path to the repository directory.
- `<connection_name>.target_dir`: Define the relative path within the repository where the code should be placed. Ensure it ends with a '/' to denote a folder.
- `<connection_name>.commit_msg`: Customize the commit message using template variables {code_type}, {id}, and {info}.
- `<connection_name>.overwrite`: Set to 'false' to prevent overwriting existing files during deployment.
- `<connection_name>.user`: Use the PAT value generated during its creation process.

This configuration is crucial for smooth deployment to GitHub.

### Deploying to Azure DevOps

1. Create a Personal Access Token (PAT) following the [Azure DevOps PAT Documentation](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Windows#create-a-pat). Full permissions for the Code scope are required for deployment.
2. Configure the connection in your VaultSpeed Agent as follows:

- `<connection_name>.repo = "<path to repository directory>"`: Specify the path to the repository directory.
- `<connection_name>.target_dir = <relative path to folder within the repo where the code should be placed>`: Define the relative path within the repository where the code should be placed.
- `<connection_name>.commit_msg = "Vaultspeed {code_type} generation ({id})\n\n{info}"`: Customize the commit message using template variables {code_type}, {id}, and {info}.
- `<connection_name>.overwrite = false`: Set to 'false' to prevent overwriting existing files during deployment.
- `<connection_name>.user = <the value of your PAT, this is only shown just after creating it>`: Use the PAT value generated during its creation process.
- `<connection_name>.password = <the value of your PAT, this is only shown just after creating it>`: Password value for the PAT (keep this secure and only visible at the time of creation).

Ensure the PAT has the necessary permissions to perform deployment tasks.

### Deploying to Bitbucket 

1. **Create a Repository Access Token**

- Follow the [Bitbucket Repository Access Token](https://support.atlassian.com/bitbucket-cloud/docs/create-a-repository-access-token/) documentation for detailed instructions.
- The Token will require Read and Write permissions to deploy the code.

2. **Cloning the Repository**
  - Use the following command to clone the repository:

`git clone https://x-token-auth:{repository_access_token}@bitbucket.org/{workspace}/{repository}.git`

3. **Setting User Email**

- Update the git config file if the URL in the command doesn't match the one in the config file.
- Run the command to set the user email as mentioned in the Bitbucket UI after creating the Token:

`git config user.email "{botid}@bots.bitbucket.org"`

- This command with the correct `botid` can also be found later on by going to `https://bitbucket.org/<workspace>/repository/admin/access-tokens` and clicking on the name of your token.

4. **VaultSpeed Agent Configuration**

- `<connection_name>.repo = "<path to repository directory>"`: Specify the path to the repository directory.
- `<connection_name>.target_dir = <relative path to the folder within the repo where the code should be placed>`: Define the relative path within the repository where the code should be placed.
- `<connection_name>.commit_msg = "Vaultspeed {code_type} generation ({id})\n\n{info}"`: Customize the commit message using template variables {code_type}, {id}, and {info}.
- `<connection_name>.overwrite = false`: Set to 'false' to prevent overwriting existing files during deployment.
- `<connection_name>.user = "x-token-auth"`: Use "x-token-auth" as the user.
- `<connection_name>.password = "<value of the Access Token, this is only shown just after creating it>"`: Use the Access Token value generated during its creation process (keep this secure and only visible at the time of creation).