Link an app to source control in ServiceNow Studio
Link an application or application customization to a Git repository in ServiceNow Studio so application developers can manage changes directly from the platform.
Before you begin
- Review Manage customizations to applications before linking a customization.
- Create a dedicated Git repository for the application. For increased security, enable multi-factor authentication for the Git repository.
- Generate an access token for the source control integration to use instead of a password and multi-factor authentication passkey when creating a Credential record. Search for personal access token on GitHub or GitLab.
- Restrict permissions on the access token to allow read and write access to the Git repository.
- Verify that the non-production instance has network access to the Git repository.
- Ensure that each user adds the email address they use in their Git commits to their Users table [sys_user] record.
- Role required: admin
About this task
Source control integration does not support linking to an application or customization on a production instance. To install applications on a production instance, use the application repository, an update set, or ServiceNow Studio.
Procedure
Navigate to All > App Engine > ServiceNow Studio.
In the file navigator, select the application you want to open.
Select App details to open the app in the canvas.
Select Source control > Link to source control.
Link to source control dialog box
- Enter the connection details for the Git repository.
| Field | Description |
|---|---|
| Network protocol | HTTPS or SSH credential type that enables secure channel data exchange. |
| URL | The URL of the Git repository where you want to save application files. For SSH protocol, use the following command to generate a private key: ssh-keygen -t rsa -m PEM -b 4096 -C "email@address".Note: If the SSH URL provided by your Git server does not work, contact your Git server owner or provider for the correct URL. Additional specifications such as scheme protocol prefixes and port numbers may be required. |
| Branch | The repository branch to use for commits. The default branch is set to "main" if it is not already set in the remote repository. If there is no default branch in the remote Git repository, the instance creates a new default branch named "main". Configure this using the `glide.source_control.git_default_branch` system property. |
| MID Server Name | The name of the existing MID Server to link through. Use a separate MID Server to prevent conflicts with Discovery activities.Verify that the MID Server user can create files in the \[sys\_attachment\] table and that the table accepts files of the "bundle" type. Connecting through a MID Server enables access to repositories behind a firewall. For more information, see MID Server. |
| Default email | The committer email address is taken from the sys\_user record when available. If a committer's sys\_user record email field is empty, the ServiceNow AI Platform generates an alternate email address \(username@instancename.service-now.com\). Enter a default email address to use when no sys\_user email is available.To use the default email address in all cases, select the check box. |
| Credential | The credential to use with the selected protocol. For more information about creating credentials, see Get started with credentials.Note: For SSH protocol, enter a valid credential of the SSH private key type. For HTTPS protocol, enter a valid credential of the Basic Auth credentials type. |
| Commit Comment | An optional description of the repository or application. |
**Note:** All application developers on the instance share a single set of repository credentials.
Select Link to source control.
The ServiceNow AI Platform validates the connection and user credentials and displays a success message. All application developers on the instance can now use the linked Git repository to manage changes.
Parent Topic:Source control integration in ServiceNow Studio
Related topics