Git Sync support for Gitlab

Hi –

I'm trying to set up Git syncing with Gitlab (instead of Github) using my on-premises instance of Retool. I was able to set up a deploy key, and have confirmed that Retool is pushing updates to the git repository. However - I haven't been able to get the app to pull from GIT. I've tried committing directly to the repo, as well as merging in changes from my other Retool environment's branch.

In the logs, I see "[GIT_SYNC] No changes found." outputted periodically, with no change when I add a new commit to the git repository (on the branch set up with the Retool instance).

Help is appreciated! :slightly_smiling_face:

Hi @thomasdashney — thanks for posting and welcome to the Retool community!

Git Syncing has two modes: write-only and read-only. By default, when you set it up it operates in write-only mode. Can you confirm that you’ve added the VERSION_CONTROL_LOCKED=true environment variable to flip git syncing into read-only mode? That will start pulling changes from the repository.

Note that a single Retool instance can only operate in one mode. Typically, folks will set up one write-only instance (development environment) and 1+ read-only instances (staging, prod, etc).

More information here:

Gotcha - I missed that part of the docs. I think the Read-only terminology confused me – it may be more clear to refer to the two modes as ‘Write-only’ and ‘Read-only’.

I deployed a fresh instance of Retool (new DB), set VERSION_CONTROL_LOCKED=true, and configured Git (added the Retool deploy key to the repository, and pointed Retool at the git: repository and branch), but I’m still not seeing the apps from the repository in Retool. I also tried creating a Github repo to see if it was a Gitlab issue, but not having any luck.

Some more detail:

  • I’m unable to create apps in this instance (since it’s GIT-controlled)
  • I am seeing the [GIT_SYNC] No changes found. logs.

Should I see all of the apps appear in Retool after configuring the Git repository & branch? Wondering if I’m missing a step.

@alex Following up ... I was able to get it to sync by re-deploying the Retool server instance (so the server boots up). See screenshot for the console output.

However -- it doesn't pull any further update from Git. Instead, it looks like it tries to push to Git. For me, this will fail because the Gitlab deploy key is read-only.

Is it intended that I would have to restart (redeploy) a Retool server each time I want it to pull from Git?

Hi thomasdashney!

As alex mentioned, the VERSION_CONTROL_LOCKED=true controls whether or not the instance in read-only or write-only. It can't ever be both at the same time (this helps avoid conflicts). The typical GitSyncing flow has multiple Retool instances, where the production instance is read-only, and receives changes from the write-only development instances!

Hopefully this helps!