Git integration lets you sync job code and configurations between the Realtime Compute for Apache Flink development console and a remote Git repository (GitHub, GitLab, or Gitee). Use it to migrate code from local environments, collaborate across teams, enforce code review workflows, and maintain audit-ready change history.
Use cases
| Use case | What it solves | Recommended approach |
|---|---|---|
| Cloud migration | Push local Flink SQL code to a cloud Flink cluster through Git, without manual export or import. | After pulling code, continue development directly in the console. Pulling does not modify the Git repository. |
| Collaborative development | Share and version-control job drafts and configurations. Create feature branches (such as feature/topic) for parallel development and bug fixes, then merge them into the main branch after tests pass. |
Commit all SQL code changes through Git and use the console for pulling and verification. Use Git branch management to keep the main branch stable. |
| Quality assurance and risk governance | Use pull requests for code review. Pull code into the console for testing. Track changes and pinpoint issues using commit history. | Commit all SQL code changes through Git. Check commit history regularly to keep changes traceable. |
| Disaster recovery and compliance | Git provides distributed backup against accidental file deletion. Git logs give a verifiable record of all job logic changes for audit compliance. | Push SQL code updates to Git regularly. Recover code from Git when needed. Use Git logs to track all essential operations. |
Prerequisites
Before you begin, ensure that you have:
-
A Flink workspace. See Create a workspace
-
Access to a remote Git repository (GitHub, GitLab, Gitee, or Alibaba Cloud DevOps)
-
Internet access enabled for your Flink workspace. See Configure internet access
-
(For IP-whitelisted repositories) The IP address of your Flink workspace added to the repository's whitelist
Limitations
| Constraint | Detail |
|---|---|
| Supported job type | SQL only |
| Permissions | To configure Git integration or edit an existing configuration, you must be the namespace owner or a member with equivalent permissions |
| One repository per namespace | Each namespace can bind to only one Git repository and a single branch. To manage multiple repositories or branches, create additional namespaces |
| Folder depth | Maximum seven levels. Files at level eight or deeper cannot be pulled into Flink |
| JSON file sync | Adding or deleting .json files in Git is not replicated in the console. Modifying .json files updates the configurations of the SQL draft with the same name |
| Merge conflicts | Avoid editing the same file in Git and the console at the same time. If concurrent edits occur, Flink runs a conflict check during push or pull and requires manual resolution |
Step 1: Associate a Git repository with a namespace
-
Create an internet connection and test connectivity. Skip this step if an internet connection already exists.
-
Go to the development console.
-
Log in to the Realtime Compute for Apache Flink management console.
-
In the Actions column of the target workspace, click Console.
-
-
Configure the Git repository for the namespace.
-
In the upper-right corner, click the profile picture, then click User Profile.

-
In the Actions column of your namespace, click Git Config.

-
Fill in the Git repository configuration.

Field
Description
Provider
The Git provider. Valid values: GitHub, GitLab, Gitee.
Repository URL
The URL of your Git repository. Must start with
HTTPorHTTPSand end with.git. Maximum 64 characters.Username
Your Git account username. The account must have the required permissions on the target repository.
Personal Access Token
The personal access token (PAT) used for authentication.
For instructions, see Managing personal access tokens (GitHub) or Personal access tokens (GitLab).
Branch
The branch to bind to this namespace. Each namespace can bind to one branch only.
-
Click OK. The Git repository and branch are now associated with your namespace.
To switch to a different repository or branch, click Git Config to unbind the current one, then bind the new one.
-
Step 2: Push or pull updates
| Operation | When to use |
|---|---|
| Push changes | Send SQL code and configuration changes from the console to the remote Git repository. |
| Pull changes | Bring SQL code or job configurations from the remote Git repository into the console. |
| Resolve merge conflicts | Fix conflicts detected during a push or pull when the same file was edited in both places. |
Push changes
-
On the Development > ETL page, click Git - Push.

-
In the Changes field, review additions (A), modifications (M), and deletions (D). Click a letter to view the diff.
-
Enter a Commit Message and click Commit And Push. If the push is rejected due to conflicts, the system will prompt you to pull updates from the remote repository first. After pulling, resolve any merge conflicts, then push again.

-
Verify the results in your Git repository. Each new SQL draft pushed to Git produces two files with the same name but different extensions: Updates modify the corresponding
.sqlor.jsonfile.-
filename.sql— the SQL code. -
filename.json— the job configurations, including draft name, draft ID, execution mode, and engine version.

-
Pull changes
-
On the Development > ETL page, click Git - Synchronize Changes to fetch the latest state from Git. The time of the last synchronization appears to the right of the icon. If it is not recent, click the icon to refresh. If updates are available in Git, Update Available appears next to the pull icon.


-
Click Git - Pull.
-
If no conflicts exist, proceed to step 3 to view the results.
-
If conflicts are detected, see Resolve merge conflicts below.

-
-
When the page shows Successfully pulled from the remote repository, the ETL page refreshes and displays the pulled SQL drafts. After pulling, the current draft is locked by Git. To modify or delete it, click Click To Unlock.

Resolve merge conflicts
Realtime Compute for Apache Flink does not support overall rollback. Before resolving conflicts, back up critical data (for example, copy example.sql locally) and assess the operational impact. Proceed with caution, as mishandling conflicts can lead to irreversible consequences.
-
On the conflicting file, click Resolve.

-
On the conflict resolution page, select the conflicting code and choose the appropriate action.
Button Action Accept Current Change Keeps the original version of the code. Accept Incoming Change Applies the change from the remote Git repository. Accept Both Changes Applies both the local and remote changes. 
-
Click Resolved.
-
Click Continue.
What's next
-
For common Git operations such as cloning repositories, committing code, and creating pull requests, see the GitHub get-started guide or the GitLab Git tutorial.
-
To automate deployments with CI/CD, see the GitLab CI/CD quick start or the GitHub Actions quick start guide.GitLab CI/CD Quick Start or GitHub Actions Quick Start