Skip to main content

Git export

Create an audit trail by exporting your Hex projects and components to a Git repository.

info
  • Available on the Team and Enterprise plans
  • Users will need the Admin role to set up Git export repositories.
  • Users will need Can Edit permissions or higher to enable Git export for a project.

Hex projects and components can be exported to a Git repository. Hex projects are represented in Git repos as YAML files that describe the logic and configurations of each cell, as well as information about your app layout. You can read more about the file format here.

This feature lets teams keep a copy of their code outside of Hex, allowing users to track changes over time and audit code as needed.

When using this feature, it is recommended to set up a connection to a dedicated repository used only for exporting Hex projects. Since Hex merges commits on behalf of the user who is publishing a project, this feature is not compatible with repositories that use branch protection. The repository must allow users to merge commits without requiring a review.

Hex projects can be exported to a Git repo on a per-project basis. Once Git export is enabled for a project, publishing a version will create a merge commit on the specified publish branch.

Supported Git Providers

The following Git providers are supported:

Git ProviderNotes
GitHubRepositories must be hosted on github.com
GitHub Enterprise ServerAvailable for Hex workspaces on the Enterprise plan
GitLabRepositories must be hosted on gitlab.com
BitbucketRepositories must be hosted on bitbucket.org

Configuring a Git provider

Only Admins are able to set up Git export providers and repostiroes. The repository access must also be approved by a repository admin on the Git side.

  1. Head to the SettingsIntegrationsGit project export.
  2. Select + Git Provider, and select GitHub.
  3. Complete the app installation and OAuth flow in GitHub — you will be redirected back to Hex when completed.

Note that only one GitHub account can be connected to a given Hex workspace. Similarly, a given GitHub account can only be connected to one Hex workspace.

Configuring Git repos

Once a Git provider has been configured, choose which repositories are available as Git export targets.

  • Add a repository using the "+ Repository" button
  • Choose a publish branch: this is the branch that will reflect the published version of your app
  • Choose which groups are able to write to the repository

Export a Hex project to a Git repo

To export a project to a repo:

  1. From the History & versions tab of the left side panel, turn on Git export. If multiple repos are enabled for your workspace, you will be able to choose which repo to export to.
  2. Choose a file path that you would like Hex to use as the name of the exported file. By default, Hex will choose a file path that matches your project name.

Each time you save a version of your work, a commit will be written to a working branch (a separate branch per project). The commit will use the current Hex user’s email as the author.

When you next publish your project, Hex will merge the commits to your publish branch.

FAQs

Can I require Git export for all my projects?

Not currently; Git export must be enabled on a per-project basis.

What happens if I turn off Git export?

If Git export is turned off for a project, the file in Git will not be deleted. The commit history will remain in the repository.

What happens if I am not an admin on the repository I want to connect to Hex?

If you are not an admin on the repository you want to connect to Hex, you will not be able to add the repository until an admin of the repo approves the connection. If you are connecting to GitHub and do not have the appropriate access to a repository, the repo will have a "request" tag next to it when configuring access. This will send a request to the repository's admins to approve the connection.

How do I change the name of the file that I’m writing to?

If you would like to change the name of the file you are writing to, make sure to do so from Hex.

  1. In the Git export settings for your project, click the three-dot menu next to the repo and branch name.
  2. Update the file path you want to write to from Hex.
  3. Publish a new version.

Publishing will merge the commit to the new file path. The existing commit history will remain in the old path.

What happens if my repository uses branch protection?

Git export is not compatible with repositories that use branch protection or require reviews before merging commits. Turn these settings off on your repository in order to use this feature successfully.

How can I pull in external changes made in my Git repo?

At this time, Git export is one-way only.