Skip to main content
Browse docs

Choose code storage and connect GitHub

Decide whether 1904 hosts your apps' code or each app gets a private repository in your own GitHub, and keep the connection healthy.

On this page

Every app 1904 builds keeps its code in a private repository. Before your first app, the workspace owner decides where those repositories live: hosted privately by 1904, or in your own GitHub account. This applies to both the Use Our AI and Bring Your AI plans.

Only the account owner can make this choice. Until they do, other people in the workspace can't create apps.

When you choose

You're asked once. On a paid plan it's the setup step Choose where your code lives. If you skipped it, 1904 asks Where should your code live? the next time you create an app or bring in existing code.

Option 1: We'll host it for you

Select We'll host it for you. There's nothing to set up. Your code is kept private, and you can always take a copy.

To get your code, open the app, go to its Settings, and find the Your code card:

  • Download code saves a zip of the app's main branch.
  • Browse code opens the repository in a code browser, where you can read files and history.
  • HTTPS Git URL is the repository's address for Git. Copy URL copies it.

Some older workspaces only have Download code.

Clone or pull with a read-only token

To run git clone or git pull against that address from your own computer or server, create a token. If you can change the app's settings, the card has a Read-only Git deploy tokens section:

  1. Type a label that says where the token will be used, such as the name of a server. The label is optional.
  2. Select Create read-only token.
  3. Copy it straight away. Copy token copies the token, and Copy clone command copies a complete git clone command with the token's username and the token in it. 1904 shows the token once, so save it before you select Dismiss or leave the page.

A token can read this one repository and nothing else, and it can't push. The card lists each token with its label and the date it was created. Select Revoke beside one to stop it working, for example when a server is retired or the token may have leaked.

If the card shows the address but no token section, tokens aren't available for your workspace yet. Use Download code instead.

Option 2: Connect my GitHub

Each app gets its own private repository in your GitHub account, and you keep full control of it.

  1. Select Connect my GitHub, or Connect GitHub in Settings > Source control.
  2. GitHub asks you to install the 1904 app and lists what it may do: create repositories, push code, open pull requests and comment on issues. Choose the repository access you want (see below), then Install.
  3. GitHub sends you back to 1904.

GitHub offers two kinds of repository access, and both work:

  • All repositories: each new app's private repository works straight away.
  • Only select repositories: 1904 sees only the repositories you add. Each new app still gets its own private repository in your account, but its first build waits until you add that repository on GitHub, as the next section describes.

Give 1904 access to a new app's repository

With selected repositories, a new app's page shows One step on GitHub: give 1904 access to this app's repo. This also happens when you bring in existing code as a copy in a new repository.

  1. Select Add it on GitHub. It opens the 1904 app's settings on GitHub.
  2. Under Repository access, add the repository named on the card, and save.
  3. Come back to 1904. The page updates on its own and the first build starts. If it hasn't after a minute, select Check access.

Only someone who administers the GitHub account can choose repositories there. A member who creates an app sees Waiting on one step on GitHub instead, and the account owner is notified to add it.

Repositories you pick from your GitHub when bringing in existing code need no extra step, because the list only shows repositories 1904 can already see.

Keep 1904 away from your other code

If you'd rather 1904 never sees your personal repositories and new apps need no extra step, open Prefer a separate home for your 1904 apps? Use a free GitHub organization under the choice. It walks you through creating a free GitHub organization, then Connect to your organization. When GitHub asks where to install, pick the new organization and choose All repositories there. 1904 then sees that organization only.

If your organization blocks GitHub apps

Select Use an access token instead in Settings > Source control. Paste a GitHub token, add the organization name if your repositories belong to one, and select Connect with token. Use the app installation if you can: you can revoke it from GitHub at any time.

Check and manage the connection

Open Settings > Source control. Code storage shows where your code lives: Your GitHub, Hosted by 1904, or Not set. When GitHub is connected, it also shows the GitHub account, how it's connected, and its Repository access: All repositories or Only selected repositories.

Code storage on the Settings page showing Your GitHub with the account, Repository access and the Check connection, Manage on GitHub and Disconnect buttons

  • Check connection confirms 1904 can still reach your repositories. Use it after you change anything on GitHub.
  • Manage on GitHub opens the installation on GitHub, where you can change repository access.
  • With selected repositories, Use a different account or organization installs 1904 somewhere else, such as an organization made for your 1904 apps.
  • When GitHub is connected through the 1904 app, Authorization shows when your GitHub authorization expires. It extends on its own as 1904 uses it.

When your GitHub authorization runs out

In the last 14 days before your GitHub authorization expires, a notice saying how many days are left appears on your Dashboard and in the sidebar. Select Renew GitHub and approve on GitHub. You can dismiss the reminder, but it comes back while the expiry is near.

Once it has expired, the notice says "GitHub authorization expired", and 1904 can't create repositories, check repository access or sync pull requests until you select Reconnect GitHub. A task submission that stopped for this reason offers Reconnect GitHub too; reconnect, then submit again. Your apps and repositories aren't changed. After you approve, Settings > Source control says "GitHub authorization refreshed."

If someone removed the 1904 app on GitHub, Source control says "1904's access was removed on GitHub". Select Reinstall GitHub App to get access back without removing your apps.

If you can't change the workspace's settings, the notice asks you to have your workspace owner reconnect GitHub in Settings > Source control instead.

If you move or rename an app's repository

When you transfer an app's repository to another GitHub organization, or rename it, point the app at the new location. You need to be able to change the app's settings.

  1. Open the app, go to its Settings, and find the Your code card. For an app on GitHub it has Open on GitHub and the repository's HTTPS Git URL.
  2. Select Switch GitHub repository. 1904 checks the GitHub organizations you've connected.
  3. If it finds the repository at its new location, it says "Found this repository at its new GitHub location." and selects it under Target GitHub repository, marked "(moved repository match)". Otherwise choose the repository from the list. A repository that's connected to another of your apps can't be chosen.
  4. If the repository went to an organization where 1904 isn't installed, select Install 1904 on another organization and install it on GitHub. You come back to the same card, where Refresh list reloads the choices.
  5. If you choose a repository that isn't the original one, the card warns that it has a different GitHub ID. Tick the box to confirm the app should use it.
  6. Select Save and Switch Repository.

The card then shows the new address, with a message such as "Repository switched and workspace Git remote updated." If the message says the repository was saved but your workspace couldn't be updated, select Retry workspace sync.

If GitHub is connected with an access token, the card asks for the GitHub owner and Repository name instead of showing a list, and you need administrator access to that repository. If it asks you to Reconnect GitHub, your GitHub authorization needs renewing first.

If you see "Deploy keys are disabled for this repository on GitHub", the switch is saved but your workspace can't reach the repository yet. Enable deploy keys in the GitHub organization's Member privileges or in the repository's Deploy keys settings; Open GitHub org settings and Open repo deploy keys take you there. 1904 keeps checking for two minutes and finishes on its own. After that, select Check now.

Changing your mind

  • From hosted to GitHub: select Connect GitHub in Settings. New apps get repositories in your GitHub. Apps you already have keep their code where it is. To move one, download its code and push it to GitHub yourself.
  • Disconnect removes the connection from 1904 and leaves your choice unset, so 1904 asks again on your next app. Existing repositories aren't moved or deleted. To remove 1904's access on GitHub's side too, uninstall the app there.

Don't archive or delete an app's repository on GitHub while the app is in use. 1904 builds and releases from that repository. If you rename it or move it to another organization, switch the app to its new location straight away, as described above.