---
# System prepended metadata

title: Query 184

---

Configuring Visual Studio Code's integrated terminal profiles can be done by modifying the settings.json file. Below is a Python script that adds or modifies terminal profiles in Visual Studio Code, including the addition of Git Bash. This script assumes that you have the necessary permissions to modify the VS Code settings [1][2].
```java
import json
import os

# Path to the settings.json file
settings_file = os.path.expanduser("~/.config/Code/User/settings.json")

# Load the existing settings, if available
if os.path.isfile(settings_file):
    with open(settings_file, "r") as f:
        settings = json.load(f)
else:
    settings = {}

# Define the Git Bash profile settings
git_bash_profile = {
    "path": "C:\\Program Files\\Git\\bin\\bash.exe",  # Modify the path to Git Bash as needed
    "args": [],
    "name": "Git Bash",
    "icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico",  # Modify the path to the Git Bash icon
}

# Create or update profiles in the terminal.integrated.profiles.windows section
if "terminal.integrated.profiles.windows" not in settings:
    settings["terminal.integrated.profiles.windows"] = {}
settings["terminal.integrated.profiles.windows"]["Git Bash"] = git_bash_profile

# Set the default profile
settings["terminal.integrated.defaultProfile.windows"] = "Git Bash"

# Save the updated settings to settings.json
with open(settings_file, "w") as f:
    json.dump(settings, f, indent=4)

print("Git Bash profile added and set as the default profile in Visual Studio Code.")
```
Before running this script, ensure that you have Visual Studio Code installed and that you've replaced the paths to Git Bash and its icon with the correct paths for your system.
Here's how the script works:
* It reads the existing settings from the settings.json file in your VS Code configuration folder.
* It defines the settings for the Git Bash profile, including the path to the Git Bash executable and the path to an icon (you can adjust these paths as needed).
* It creates or updates the terminal.integrated.profiles.windows section in the settings with the Git Bash profile.
* It sets the Git Bash profile as the default profile using the terminal.integrated.defaultProfile.windows setting.
* It saves the updated settings back to the settings.json file.

Run the script, and it will add the Git Bash profile to your Visual Studio Code's integrated terminal and set it as the default profile.