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
reposcope. Fine-grained tokens aren't supported. The steps to create one are below.
Steps
1. Create a GitHub token
- Sign in to GitHub.
- Go to Settings → Developer settings.
- Click Personal access tokens → Tokens (classic).
- Click Generate new token (classic).
- Give the token a name, for example
TeleportHQ export, and tick the repo scope. - 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
- Open your project in the TeleportHQ editor.
- At the top right, click Code.
- Click the Download tab.
- Click the card for the format you want, for example Next. The last card (the project file) can't be exported to GitHub.
- At the bottom of the window, click Export to GitHub.
- 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.
- 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
- Make your changes in the TeleportHQ editor.
- Open Code → Download.
- Pick the same format as last time.
- 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:
- Click the Project settings cog at the bottom of the left sidebar.
- Under Integrations, click GitHub ("Access token for code publishing.").
- In the field under GitHub, select the asterisks that stand for the saved token and paste the new token.
- Press Enter, or click outside the field. The token saves itself: there's no Save button. The message "The changes have been saved" appears.
In the editor, emptying the field puts the saved token back. To remove the token, use the project's settings page instead:
- On the dashboard, click ⋯ on the project's card, then Project Settings.
- In the menu on the left, click Integrations.
- Clear the GitHub field.
- 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.appor.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.