| 1 | --- |
| 2 | title: GitHub |
| 3 | description: Sign in with GitHub, link your account, and import repositories from GitHub through g1t's GitHub App. |
| 4 | --- |
| 5 | |
| 6 | g1t has one GitHub App, [g1t-sh](https://github.com/apps/g1t-sh). It does two |
| 7 | things: it signs you in with your GitHub account, and, once you install it |
| 8 | on a GitHub account or organization, it lets g1t read the repositories you |
| 9 | choose there and bring them across. |
| 10 | |
| 11 | ## Sign in with GitHub |
| 12 | |
| 13 | 1. On [g1t.sh/login](https://g1t.sh/login) or |
| 14 | [g1t.sh/register](https://g1t.sh/register), choose **Continue with GitHub**. |
| 15 | 2. GitHub asks you to authorize g1t. Choose **Authorize**. |
| 16 | 3. You are back on g1t, signed in. |
| 17 | |
| 18 | The first time, g1t makes your account: |
| 19 | |
| 20 | - **Username**: your GitHub login, in its own case, if it is free in any |
| 21 | case and follows g1t's rules (letters, digits and single hyphens, up to |
| 22 | 39 characters; see [creating an account](/guides/authentication/#creating-an-account)). |
| 23 | Otherwise you choose one. |
| 24 | - **Email**: the primary address on your GitHub account, if GitHub says it |
| 25 | is verified. Only verified addresses count, and GitHub's |
| 26 | `@users.noreply.github.com` relay addresses are not used. Your email is |
| 27 | confirmed already, so there is no link to follow. |
| 28 | - **Password**: none. Sign in with GitHub, or set a password later with |
| 29 | [Forgot your password](https://g1t.sh/forgot). |
| 30 | |
| 31 | Anyone can create an account with GitHub: choose **Continue with GitHub** |
| 32 | on [g1t.sh/register](https://g1t.sh/register). If someone invited you into |
| 33 | a workspace or onto a repository, open their invite link and choose |
| 34 | **Continue with GitHub** there instead, so the new account gets the |
| 35 | invitation. |
| 36 | |
| 37 | Signing in with GitHub does not start a trial or give your workspace |
| 38 | compute. That works as it does for any account: see |
| 39 | [usage and billing](/guides/usage-and-billing/). |
| 40 | |
| 41 | ### If an account already has your email |
| 42 | |
| 43 | If one of your verified GitHub addresses belongs to a g1t account that is |
| 44 | not linked to GitHub, g1t does not link them on its own: owning the GitHub |
| 45 | account does not prove you own the g1t one. g1t shows **An account with |
| 46 | this email exists. Sign in to link GitHub**. Sign in to that account with |
| 47 | its password, and GitHub is linked to it. From then on, **Continue with |
| 48 | GitHub** signs you in to it. |
| 49 | |
| 50 | The offer lasts 30 minutes. If you sign in to a different account in that |
| 51 | time, GitHub is linked to the account you signed in to. |
| 52 | |
| 53 | ## Link and unlink GitHub |
| 54 | |
| 55 | In [Settings → GitHub](https://g1t.sh/settings/github): |
| 56 | |
| 57 | - **Link GitHub** sends you to GitHub and links the account you authorize. |
| 58 | One GitHub account links to one g1t account, and the other way round. |
| 59 | - **Unlink** removes the link and ends g1t's authorization on GitHub. It is |
| 60 | refused while GitHub is the only way you sign in: set a password first. |
| 61 | - **Link again** appears when g1t's access to your GitHub account has |
| 62 | ended, for example because you revoked it on GitHub. Linking again is |
| 63 | needed to import repositories, not to sign in. |
| 64 | |
| 65 | g1t identifies your GitHub account by its numeric id, not its login, so |
| 66 | renaming yourself on GitHub keeps the link. Signing in, linking and |
| 67 | unlinking are recorded in the [audit log](/guides/audit-log/) of each |
| 68 | workspace you belong to, as `github.sign_in`, `github.linked` and |
| 69 | `github.unlinked`. |
| 70 | |
| 71 | ## Import a repository |
| 72 | |
| 73 | 1. Choose **New project**, then **Import from GitHub**. You can also go to |
| 74 | `g1t.sh/new/github`. |
| 75 | 2. If your GitHub account is not linked yet, choose **Connect GitHub**. |
| 76 | 3. If no GitHub account is connected to the workspace, a workspace owner |
| 77 | chooses **Install on GitHub**, picks the GitHub account or organization, |
| 78 | and chooses which repositories the app may see. GitHub returns you to |
| 79 | g1t, which records the installation for the workspace. If the app is |
| 80 | installed on GitHub already, add it instead: see |
| 81 | [already installed the app on GitHub](#already-installed-the-app-on-github). |
| 82 | 4. Tick the repositories to bring across. You see only repositories that |
| 83 | both you and the app can reach. |
| 84 | 5. Choose whether to copy their issues. |
| 85 | 6. Choose **Bring to g1t**. |
| 86 | |
| 87 | Each repository becomes a repository on g1t with the same name, private if |
| 88 | it is private on GitHub, and a [project](/guides/projects/) of its own. It |
| 89 | is copied once: the g1t repository is then its own, and you push to g1t. |
| 90 | Nothing on GitHub changes. |
| 91 | |
| 92 | ### Already installed the app on GitHub? |
| 93 | |
| 94 | g1t adds an installation to a workspace when GitHub sends you back to g1t |
| 95 | after you install the app. If you installed it on GitHub directly, in |
| 96 | another browser, or the return to g1t was lost, add it from g1t instead: |
| 97 | |
| 98 | 1. Make sure your GitHub account is linked: **Connect GitHub** on the import |
| 99 | page, or **Link GitHub** in [Settings → GitHub](https://g1t.sh/settings/github). |
| 100 | 2. Open `g1t.sh/new/github?workspace=<workspace>`. |
| 101 | 3. Under **Already installed on GitHub**, choose **Add to** the workspace |
| 102 | beside the GitHub account or organization. |
| 103 | |
| 104 | Only a workspace owner can add one, and only an installation your own |
| 105 | GitHub account can see: on your account, or on an organization you belong |
| 106 | to. |
| 107 | |
| 108 | If GitHub sends you to g1t after an installation that did not start from |
| 109 | g1t, g1t asks which of the workspaces you own to add it to. It is the same |
| 110 | check: the installation must be one your GitHub account can see. |
| 111 | |
| 112 | ### What comes across |
| 113 | |
| 114 | | | | |
| 115 | | --- | --- | |
| 116 | | Every branch and tag | Yes, with full history | |
| 117 | | Issues | When **Copy issues too** is ticked: up to 200, oldest first, open or closed as on GitHub, with their labels (up to 10 each) | |
| 118 | | Who opened an issue | Named in the issue: by their g1t username if they have linked GitHub, otherwise by their GitHub login. The issue itself is opened by you. | |
| 119 | | Milestones | Named in each issue; g1t has no milestones | |
| 120 | | Issue numbers | New numbers on g1t; each issue links to the original | |
| 121 | | Comments on issues | No | |
| 122 | | Pull requests | No. Their branches come across; open pull requests stay on GitHub. | |
| 123 | | GitHub Actions workflows | Yes, as files. Rename `.github` to `.g1t` to run them on g1t: see [GitHub Actions](/guides/actions/). | |
| 124 | | Releases, wikis, Git LFS objects | No | |
| 125 | |
| 126 | A repository is copied in one piece of at most 40 MB, after compression. |
| 127 | Push a larger one with git instead: see [git](/guides/git/). |
| 128 | |
| 129 | ## What g1t's GitHub App can do |
| 130 | |
| 131 | | Permission | Access | Why | |
| 132 | | --- | --- | --- | |
| 133 | | Contents | Read | Clone the repositories you choose. | |
| 134 | | Metadata | Read | Required by GitHub for every app: names, visibility, and whether a branch is protected. | |
| 135 | | Issues | Read | Copy issues when you ask. | |
| 136 | | Email addresses (account) | Read | Find your verified email when you sign in. | |
| 137 | |
| 138 | The app only ever sees the repositories you or your organization's owners |
| 139 | choose on GitHub. g1t keeps your GitHub user token, which expires every 8 |
| 140 | hours, and its refresh token, encrypted at rest, and uses them only to list |
| 141 | your installations and repositories. Repository access uses short-lived |
| 142 | installation tokens, which g1t gets as the app when it needs one. |
| 143 | |
| 144 | ## Revoke or uninstall |
| 145 | |
| 146 | - **Stop signing in with GitHub**: unlink it in Settings, or revoke **g1t** |
| 147 | in GitHub under **Settings → Applications → Authorized GitHub Apps**. |
| 148 | Revoking on GitHub ends g1t's access at once; you can still sign in with |
| 149 | GitHub afterwards, which authorizes g1t again. |
| 150 | - **Stop g1t reading repositories**: uninstall the app in GitHub under |
| 151 | **Settings → Applications → Installed GitHub Apps** (for an organization, |
| 152 | its settings). Repositories already imported stay on g1t. |
| 153 | - **Change which repositories it sees**: **Choose repositories on GitHub** |
| 154 | beside the account on the import page. |
| 155 | |
| 156 | ## The webhook |
| 157 | |
| 158 | GitHub tells g1t about installations and repository changes at |
| 159 | `POST https://api.g1t.sh/hooks/github`. g1t checks each delivery's |
| 160 | `X-Hub-Signature-256` against the app's webhook secret, ignores a delivery |
| 161 | id it has already seen (`X-GitHub-Delivery`), and answers `202` before |
| 162 | acting on it. |
| 163 | |
| 164 | | Answer | When | |
| 165 | | --- | --- | |
| 166 | | `202` | Received; acted on afterwards | |
| 167 | | `200` | A delivery already received | |
| 168 | | `400` | No `X-GitHub-Delivery`, or a body that is not JSON | |
| 169 | | `401` | Not signed with the app's webhook secret | |
| 170 | | `404` | No GitHub App is configured on this g1t | |
| 171 | | `413` | A body over 10 MB | |
| 172 | |
| 173 | On your own g1t, register an app of your own: see |
| 174 | [run g1t yourself](/guides/self-hosting/#sign-in-with-github-and-import-from-github). |