docs/versioned_docs/version-2.39.0/gitsync.md
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
<div className='badge badge--primary heading-badge'>Available on: Paid plans</div>The GitSync feature enables synchronization of workspace applications with a git repository, streamlining application management and version control on ToolJet.
<div style={{paddingTop:'24px', paddingBottom:'24px'}}>ToolJet applications can be synchronized with a Git repository, offering the flexibility to tailor your application development and deployment processes across various environments while aligning with best practices for the application development lifecycle.
</div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>GitSync provides a straightforward solution for creating backups of your applications. By pushing changes to a Git repository, users can ensure a secure and versioned history of their application. This serves as a reliable backup mechanism, safeguarding against accidental application/version deletion or corruption.
Facilitating the movement of applications across different ToolJet deployments (e.g., from development to staging to production), GitSync acts as a pivotal tool for environment migration. Users can effortlessly transfer their applications across environments by pushing changes to a Git repository.
<div style={{textAlign: 'center'}}> </div> </div> <Tabs> <TabItem value="GitHub" label="Setting up GitSyncing with GitHub"> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>:::caution
master.
:::Create a new repository on GitHub. The repository can be public or private. You can also use an existing repository. Make sure that the repository is empty.
<div style={{textAlign: 'center'}}> </div>Obtain the SSH URL of the repository. When a repository is created, GitHub shows a screen with the repository URL. If the repository is already created, you can obtain the URL by clicking on the Clone or download button.
<div style={{textAlign: 'center'}}> </div>Go to the Workspace settings, and click on the Configure git tab. Enter the SSH URL of the repository (obtained in Step 2) in the Git repository URL field. Click on the Generate SSH key button, and copy the SSH key that is generated. The SSH key is used to authenticate ToolJet with the repository.
There are two types of generated SSH keys: **
Go to the Settings tab of the GitHub repository that you created in Step 1, and click on the Deploy keys tab. Click on the Add deploy key button.
<div style={{textAlign: 'center'}}> </div>Enter a title for the SSH key in the Title field. Paste the SSH key that you copied in Step 3 in the Key field. Make sure that the Allow write access checkbox is checked, especially when configuring the GitSync feature to push changes to Git. However, it is not mandatory to check this option when setting up the GitSync feature for pulling changes from Git. Finally, click on the Add key button.
<div style={{textAlign: 'center'}}> </div>Go back to the Configure git tab on ToolJet, and click on the Finalize setup button. If the SSH key is configured correctly, you will see a success message.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>When you promote an environment, from Developement to Staging, the changes will be automatically committed to the git repository. The commit message will be <version_number> Version of <app_name> promoted from <source_environment> to <destination_environment>. The author will be the user who promoted the environment. When you promote an environment, from Staging to Production, no changes will be committed to the git repository.
This option can be enabled or disabled from the Configure git tab on the Workspace settings page. By default, this option is disabled.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>To enable or disable the GitSync feature, go to the Configure git tab on the Workspace settings page, and toggle on/off the Connect switch. This is only available if the GitSync feature is configured.
When enabled
On clicking the GitSync button, the users will be able to commit changes to the git repository.
When disabled
To delete the GitSync configuration, go to the Configure git tab on the Workspace settings page, and click on the Delete configuration button. This will delete the SSH key from the ToolJet configuration and the GitSync feature will be disabled.
Note:
Once the initial commit is made, you can see the app files in the git repository. The repository will have the individual app folders and a .meta folder. The app folders will be named as the app name and will have the respective JSON file of the application. The .meta folder will have the meta.json file that contains the meta information of each application synced to git repo.
The meta.json file holds information about apps such as the App name, last commit message, last commit user, last commit date, version name, and version id.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>Once the GitSync feature is configured, you can start pushing changes to the git repository.
When you create a new app, you will see an option to select the Commit changes. If you select the commit changes option, the changes will be committed to the git repository.
:::info If the app name is same as the name of the existing app in the git repo, it will overwrite the existing app in the git repo. :::
<div style={{textAlign: 'center'}}> </div>Selecting the Commit changes option will create a new commit in the git repository. The commit message will be App creation and the author will be the user who created the app.
Whenever an app is renamed, the changes will be automatically committed to the git repository. The commit message will be App is renamed and the author will be the user who renamed the app.
Whenever a user makes a change in an app, they can make a commit to the git repository by clicking on the GitSync button on the topbar. On clicking the GitSync button, a modal will open with the option to enter the commit message. The user can enter the commit message and click on the Commit changes button to commit the changes to the git repository. Along with the commit message, the user can also see the connnected Git repo URL and the last commit details.
Last commit details helps the user to know the last commit message, author, date, and time. This helps the user to know the last commit details and make the commit message accordingly.
<div style={{textAlign: 'center'}}> </div>Once the changes are committed, the user can see the commit message, author, and date in the git repository.
<div style={{textAlign: 'center'}}> </div>Whenever a user deleted an app from the workspace, the app will not be deleted from the git repository. The app will be available in the git repository in the same state as it was before the app was deleted.
Whenever a user creates a new app version and creates a commit to git repository, the JSON file in the app folder will be replaced with the new version of the app that was created. The meta.json file in the .meta folder will also be updated with the new version id and version name.
<div style={{textAlign: 'center'}}> </div> </div>You can configure the GitSync feature on another workspace to pull the changes from the git repository. To configure the GitSync feature on another workspace, follow the steps mentioned in the Setting up GitSyncing with GitHub section.
Once the GitSync feature is configured, go to the ToolJet dashboard and click on the three dots on the right side of the Create new app button. Click on the Import from git repository option.
<div style={{textAlign: 'center'}}> </div>On clicking the Import from git repository option, a modal will open with the dropdown to select the app to be imported from the git repository. Once the app is selected, the app name and the last commit will be displayed. Click on the Import app button to import the app from the git repository.
:::caution
You can check for updates in the git repository by clicking on the GitSync button on the topbar. On clicking the GitSync button, a modal will open with the option to Check for updates. Click on the Check for updates button to check for updates in the git repository. If there are any updates, you will see the details of the updates such as commit message, author, and the date in the modal. Click on the Pull changes button to pull the changes from the git repository.
<div style={{textAlign: 'center'}}> </div> </TabItem> <TabItem value="GitLab" label="Setting up GitSyncing with GitLab"> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>:::caution
master.
:::Create a new repository on GitLab. The repository can be public or private. You can also use an existing repository. Make sure that the repository is empty.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>Obtain the SSH URL of the repository. On GitLab, you can obtain the URL by clicking on the Clone button and selecting the SSH option.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>Go to the Workspace settings, and click on the Configure git tab.
<div style={{textAlign: 'center'}}> </div>Enter the SSH URL of the repository (obtained in Step 2) in the Git repository URL field. Click on the Generate SSH key button, and copy the SSH key that is generated. The SSH key is used to authenticate ToolJet with the gitlab repository.
There are two types of generated SSH keys: **
From the top-left corner, click on the user avatar and select the Edit Profile option. Navigate to the SSH Keys tab and click on the Add new key button.
<div style={{textAlign: 'center'}}> </div>Paste the SSH key that you copied in Step 3 in the Key field, enter a title for the SSH key in the Title field, set Usage type to Authenticatioin & signing, and set the *Expiration date(optional). Finally, click on the Add key button.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>Go back to the Configure git tab on ToolJet, and click on the Finalize setup button. If the SSH key is configured correctly, you will see a success message.
<div style={{textAlign: 'center'}}> </div> </div> </div>When you promote an environment, from Developement to Staging, the changes will be automatically committed to the git repository. The commit message will be <version_number> Version of <app_name> promoted from <source_environment> to <destination_environment>. The author will be the user who promoted the environment. When you promote an environment, from Staging to Production, no changes will be committed to the git repository.
This option can be enabled or disabled from the Configure git tab on the Workspace settings page. By default, this option is disabled.
<div style={{textAlign: 'center'}}> </div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>To enable or disable the GitSync feature, go to the Configure git tab on the Workspace settings page, and toggle on/off the Connect switch. This is only available if the GitSync feature is configured.
When enabled
On clicking the GitSync button, the users will be able to commit changes to the git repository.
When disabled
To delete the GitSync configuration, go to the Configure git tab on the Workspace settings page, and click on the Delete configuration button. This will delete the SSH key from the ToolJet configuration and the GitSync feature will be disabled.
Note: Deleting the GitSync configuration will not delete the apps from the git repository. The apps will still be available in the git repository in the same state as they were before the GitSync configuration was deleted.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>Once the initial commit is made, you can see the app files in the git repository. The repository will have the individual app folders and a .meta folder. The app folders will be named as the app name and will have the respective JSON file of the application. The .meta folder will have the meta.json file that contains the meta information of each application synced to git repo.
The meta.json file holds information about apps such as the App name, last commit message, last commit user, last commit date, version name, and version id.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>Once the GitSync feature is configured, you can start pushing changes to the git repository.
<div style={{paddingTop:'24px', paddingBottom:'24px'}}>When you create a new app, you will see an option to select the Commit changes. If you select the commit changes option, the changes will be committed to the git repository.
:::info If the app name is same as the name of the existing app in the git repo, it will overwrite the existing app in the git repo. :::
<div style={{textAlign: 'center'}}> </div>Selecting the Commit changes option will create a new commit in the git repository. The commit message will be App creation and the author will be the user who created the app.
Whenever an app is renamed, the changes will be automatically committed to the git repository. The commit message will be App is renamed and the author will be the user who renamed the app.
Whenever a user makes a change in an app, they can make a commit to the git repository by clicking on the GitSync button on the topbar. On clicking the GitSync button, a modal will open with the option to enter the commit message. The user can enter the commit message and click on the Commit changes button to commit the changes to the git repository. Along with the commit message, the user can also see the connnected Git repo URL and the last commit details.
Last commit details helps the user to know the last commit message, author, date, and time. This helps the user to know the last commit details and make the commit message accordingly.
<div style={{textAlign: 'center'}}> </div>Once the changes are committed, the user can see the commit message, author, and date in the git repository.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>Whenever a user deleted an app from the workspace, the app will not be deleted from the git repository. The app will be available in the git repository in the same state as it was before the app was deleted.
</div> <div style={{paddingTop:'24px', paddingBottom:'24px'}}>When a user creates a new version of an app, there will be an option to select the Commit changes. If you select the commit changes option, the new version of the app will be committed to the git repository.
The JSON file in the app folder will be replaced with the new version of the app, the meta.json file in the .meta folder gets updated with the new version id and version name. The commit message will be Version creation and the author will be the user who created the new version of the app.
You can configure the GitSync feature on another workspace to pull the changes from the git repository. To configure the GitSync feature on another workspace, follow the steps mentioned in the Setting up GitSyncing with GitLab section.
Once the GitSync feature is configured, go to the ToolJet dashboard and click on the three dots on the right side of the Create new app button. Click on the Import from git repository option.
<div style={{textAlign: 'center'}}> </div>On clicking the Import from git repository option, a modal will open with the dropdown to select the app to be imported from the git repository. Once the app is selected, the app name and the last commit will be displayed. Click on the Import app button to import the app from the git repository.
:::caution
You can check for updates in the git repository by clicking on the GitSync button on the topbar. On clicking the GitSync button, a modal will open with the option to Check for updates. Click on the Check for updates button to check for updates in the git repository. If there are any updates, you will see the details of the updates such as commit message, author, and the date in the modal. Click on the Pull changes button to pull the changes from the git repository.
<div style={{textAlign: 'center'}}> </div> </div> </div> </TabItem> </Tabs>