Main Content

Configure Source Control Settings

Since R2025a. Replaces Set Source Control Preferences (R2024b).

Use the general source control settings in MATLAB® to specify the default location of new Git™ and SVN working folders and disable MathWorks® source control integration.

On the Home tab, in the Environment section, click Settings. Select MATLAB > Source Control. Then, configure your settings.

To configure Git-specific source control settings, see Configure Git Settings.

SettingUsage
Source Control Integrations

MATLAB source control integration, accessible through the Files and Project panels, is enabled by default.

To disable MATLAB source control integration, clear Enable source control.

When you disable source control, MATLAB does not destroy repository information. For example, it does not remove the .svn and .git folders.

If you want to use other source control tools such as Perforce® P4V with MATLAB instead of the built-in source control integration, write your own source control integration using the Software Development Kit (SDK) available on File Exchange. Then, ensure that you select Enable 3rd-party source control integrations (requires Java). For more information, see Write a Source Control Integration with the SDK.

FilesTo configure MATLAB to prompt you about unsaved changes before performing source control actions such as commit, merge, SVN update, and Git branch switch, select Check for unsaved files before source control operations.

By default, MATLAB and Simulink® reload files modified by source control operations, such as SVN update, and Git branch switch.

To disable this behavior, clear the Reload files modified by source control operations check box.

New Working Folder

When you interactively clone or check out a working copy from a repository, by default, MATLAB downloads files into the currently opened folder. To use a folder of your choice, select Use specified folder and specify the folder by using the browser or pasting the path.

Configure Git Settings

Use the Git source control settings to specify your username and email, remember credentials for the current MATLAB session, and enable SSH authentication.

On the Home tab, in the Environment section, click Settings. Select MATLAB > Source Control > Git. Then, configure your settings.

SettingUsage
UserSpecify your username and email in the Name and Email fields. Doing so sets the value of user.name and user.email in your global Git configuration file.

MATLAB Git integration is configured by default to Generate local avatars using your initials. An avatar appears next to your username and email in the Branch Manager and when you annotate lines for files under Git source control in the MATLAB Editor.

To enable MATLAB to retrieve globally-recognized avatars from web services such as gravatar.com, select Retrieve avatars from web services instead.

To disable the usage of avatars altogether, select None instead.

Credentials

By default, MATLAB Git integration remembers usernames and tokens when you interact with Git repositories. Persist credentials is the default selection.

To configure MATLAB to remember Git credentials only in the current session, select Remember credentials for the current MATLAB session.

To disable the credential management altogether, select Disable credential management instead.

SSH

To enable the use of SSH keys, select Enable SSH.

By default, MATLAB looks for keys in the agent. On Windows®, use OpenSSH as the SSH agent. To install OpenSSH, see Get started with OpenSSH for Windows.

If you are not using an SSH agent to store your keys, you can enter them manually.

  1. Clear the Use SSH agent checkbox.

  2. Specify the Public key file by using the browser or pasting the path to your public key file. An example path is C:\Users\username\.ssh\id_ed25519.pub.

  3. Specify the Private key file by using the browser or pasting the path to your private key file. An example path is C:\Users\username\.ssh\id_ed25519.

In MATLAB Online™, SSH authentication is disabled by default. Using SSH keys in MATLAB Online requires you to store the public and private key files on MATLAB Drive.

To enable the use of a pass-phrase and receive a prompt once per session, select Key is pass-phrase protected.

Proxy

To enable the use of a proxy, select Enable proxy. Then, specify the proxy you want to use in the Proxy host field. Doing so sets the value of http.proxy in your global Git configuration file.

Commit Signing

To enable signing commits automatically, select Sign commits.

  1. Set the signing key format by selecting one of the Signing format options. Supported key formats are OpenPGP (default) and X.509. Doing so sets the value of gpg.format in your global Git configuration file.

    If you do not have an existing GPG key, you can generate a new GPG key to use for signing commits. For more information, see Generating a new GPG key.

  2. Set your signing key in the Public signing key field. Doing so sets the value of user.signingkey in your global Git configuration file.

  3. Specify the program used to sign commits in the Path to signing program field. Doing so sets the value of gpg.x509.program or gpg.openpgp.program in your global Git configuration file.

When MATLAB verifies a commit signature, a green verification icon appears next to your avatar and username in both the Branch Manager and the line annotations in the MATLAB Editor.

Branch ManagerTo control the number of commits that the Branch Manager shows, specify the Maximum number of commits to show.
EnvironmentTo enable MATLAB to use user-defined Git environment variables, select If defined, use Git environment variables. This setting is not available in MATLAB Online.
Windows

To use Git LFS, Git hooks, a credential helper, or Simulink automerge on Windows, you must install a command-line Git client and follow steps described in Additional Setup.

  • When you install Git command-line, MATLAB automatically populates Path to Git.

  • Git command-line installation by default includes Git bash that provides shell utilities. MATLAB automatically populates Path to Shell.

    Note

    • To use Git hooks in MATLAB on Windows, enable .sh files to run with Git Bash when you install command-line Git. For an example on how to use Git hooks, see Use Git Hooks in MATLAB.

    • Automerging Simulink models on Windows requires a shell to be installed. For information on how to enable automerge in MATLAB and CI pipelines, see Automatically Merge Models Locally and in CI Pipeline (Simulink).

To enable support for long paths on a Windows system, select Enable support for long paths. Doing so sets the value of core.longpaths to true in your global Git configuration file.

Configure SVN Settings

MATLAB SVN integration remembers usernames and tokens when you interact with SVN repositories.

Use the SVN source control settings to adjust or disable credential management.

  1. On the Home tab, in the Environment section, click Settings. Select MATLAB > Source Control > SVN.

  2. In the Credentials section, select from the available options.

    • The Persist credentials option is the default selection.

    • To configure MATLAB to remember SVN credentials only in the current session, select Remember credentials for the current MATLAB session.

    • To disable the credential management altogether, select Disable credential management instead.

See Also

Topics