Export

How to export your project to GitHub

How to export your project to GitHub

On a paid TeleportHQ plan, you send your website's code to GitHub from the editor: click Code, open the Download tab, pick a format, click Export to GitHub and paste a classic GitHub token. TeleportHQ creates a repository named after your project and the format, commits the code to its main branch and opens it in a new tab.

Before you start

  • Plan: GitHub export is included in Pro and Premium. It isn't available on a trial. See Can I download my site's code?
  • Project type: web apps can't be exported to GitHub.
  • Role: you need to be an Owner, Admin or Designer.
  • A GitHub account and a classic personal access token with the repo scope. Fine-grained tokens aren't supported. The steps to create one are below.

Steps

1. Create a GitHub token

  1. Sign in to GitHub.
  2. Go to Settings → Developer settings.
  3. Click Personal access tokens → Tokens (classic).
  4. Click Generate new token (classic).
  5. Give the token a name, for example TeleportHQ export, and tick the repo scope.
  6. Click Generate token, then copy the token. GitHub shows it only once.

The same steps show in TeleportHQ when you point at Where can I find my GitHub token? next to the token field.

2. Export from TeleportHQ

  1. Open your project in the TeleportHQ editor.
  2. At the top right, click Code.
  3. Click the Download tab.
  4. Click the card for the format you want, for example Next. The last card (the project file) can't be exported to GitHub.
  5. At the bottom of the window, click Export to GitHub.
The bottom of the TeleportHQ Download tab with the Export to GitHub button highlighted next to Download ZIP
  1. The first time, a field appears with the placeholder "Paste your GitHub token (classic, full access)...". Paste your token and click Save. The message "GitHub token was saved" appears.
  2. Click Export to GitHub again.

When the export finishes, the message "Your codebase is ready on GitHub: <link>" appears. The first time, the new repository also opens in a new browser tab.

Check that it worked

On GitHub, open your repositories. You see a repository named after your project and the format, for example Sunny-Bakery-Next for a project called Sunny Bakery, with your site's files on the main branch.

Update the repository after changes

  1. Make your changes in the TeleportHQ editor.
  2. Open Code → Download.
  3. Pick the same format as last time.
  4. Click Export to GitHub.

TeleportHQ commits the new code to the same repository. If you pick a different format, TeleportHQ creates a separate repository for that format.

Change or remove your GitHub token

TeleportHQ saves the token for the project. To replace it in the editor:

  1. Click the Project settings cog at the bottom of the left sidebar.
  2. Under Integrations, click GitHub ("Access token for code publishing.").
  3. In the field under GitHub, select the asterisks that stand for the saved token and paste the new token.
  4. Press Enter, or click outside the field. The token saves itself: there's no Save button. The message "The changes have been saved" appears.
The GitHub settings of the TeleportHQ Project settings panel, with the token field highlighted

In the editor, emptying the field puts the saved token back. To remove the token, use the project's settings page instead:

  1. On the dashboard, click ⋯ on the project's card, then Project Settings.
  2. In the menu on the left, click Integrations.
  3. Clear the GitHub field.
  4. Click Save Changes.

Troubleshooting

"Could not publish to GitHub. Make sure you are using a classic GitHub token and have proper credentials (repo) set on it." The token is missing the repo scope, has expired, or is a fine-grained token. Create a new classic token with the repo scope, then save it in its place (see "Change or remove your GitHub token").

The Export to GitHub button is greyed out Check these, in order:

  • The last card (the project file) is selected. Pick a code format.
  • Your workspace is on a trial or its plan has ended. The tooltip reads "Code downloads aren't included in your plan. Subscribe to unlock."

"Could not set GitHub token. Please try again." The token couldn't be saved. Check that you pasted the whole token, with no extra spaces, and try again.

"Github token is missing. Please set it from Project Settings -> Integrations section." Save a token from the Download tab footer, or from Project settings → Integrations → GitHub.

Good to know

  • New repositories are public. TeleportHQ asks GitHub for a public repository. If your code should be private, open the repository on GitHub and change its visibility in Settings.
  • Exporting doesn't publish or change your live site.
  • A Next or React export brings schema markup up to date first. Schema markup is the description of a page that search engines read. TeleportHQ rewrites the AI-written schema markup (a page's Page settings → Schema markup) of every page whose content changed since, which uses AI tokens. It's skipped while your workspace has fewer than 500 tokens, and never replaces schema markup you edited by hand. To turn this off, switch off Keep Schema Markup Up To Date in Project settings → SEO & social → Search engines. See How to add schema markup (structured data) to your pages.
  • TeleportHQ forms don't work on a site deployed from GitHub. TeleportHQ forms only accept submissions from the project's TeleportHQ address (ending in .teleporthq.app or .teleporthq.site) and the custom domain connected to the project in TeleportHQ. On a site hosted from the exported code, submissions are refused with "Domain not allowed" and nothing is saved. See Why is my form not working?.
  • Signing in with GitHub is separate. The token you save for the export belongs to the project. Removing GitHub from your sign-in methods doesn't remove it. See How to add or remove Google, GitHub or Microsoft sign-in.
Share

Related Articles

How to download your site as code (React, Next.js, Vue, HTML and more)

On a paid TeleportHQ plan (Pro or Premium), click Code at the top right of the editor, open the Download tab, pick a format such as HTML, React or Next and click Download ZIP to save your website's source code; a trial can't download code and web apps can't be downloaded.

Can I download my site's code?

Yes, on a paid TeleportHQ plan (Pro or Premium) you can download a website's code as HTML, React, Next.js, Vue, Nuxt or Angular, or export it to GitHub; a trial only lets you view the code (10 code views), and web apps can't be downloaded as code.

How to view your site's code

In the TeleportHQ editor, click Code at the top right to open the Code tab, pick a format such as HTML or React, then browse the generated files and copy any of them; a trial workspace gets 10 code views, Pro and Premium unlimited.

A tour of Project settings: everything you can set for your project

In the TeleportHQ editor, click the Project settings cog at the bottom of the left sidebar to open one panel with every project setting, grouped under Site, Appearance, Data & code, Editor, AI, Credentials and Integrations; click an entry to open it in a drawer beside the panel, and switch features such as the store or the blog on in the Plugins tab.

How to add or remove Google, GitHub or Microsoft sign-in

To add a sign-in method to your TeleportHQ account, sign in with Google, GitHub or Microsoft using the same email and confirm your existing account once; to remove one, open Account Settings → General → Authentication Providers and click Unlink (you must keep at least one method).