| 1 | --- |
| 2 | title: Git |
| 3 | description: Remotes, credentials, private repositories and limits. |
| 4 | --- |
| 5 | |
| 6 | g1t speaks git's smart HTTP protocol. Any git client works. |
| 7 | |
| 8 | ## Remotes |
| 9 | |
| 10 | ```text |
| 11 | https://g1t.sh/<workspace>/<repo>.git |
| 12 | ``` |
| 13 | |
| 14 | Public repositories can be cloned without signing in: |
| 15 | |
| 16 | ```sh |
| 17 | git clone https://g1t.sh/syntaqx/g1t.git |
| 18 | ``` |
| 19 | |
| 20 | ## Authentication |
| 21 | |
| 22 | Pushing, and reading private repositories, needs credentials. Use your |
| 23 | username, and as the password either your account password or an |
| 24 | [access token](https://g1t.sh/settings). Tokens are recommended: they can be revoked |
| 25 | individually and they also work for the API. |
| 26 | |
| 27 | To avoid typing it each time, let git store it: |
| 28 | |
| 29 | ```sh |
| 30 | git config --global credential.helper store |
| 31 | ``` |
| 32 | |
| 33 | ## Creating a repository by pushing |
| 34 | |
| 35 | Pushing to a repository that does not exist, in a workspace you belong to, |
| 36 | creates it as a public repository. |
| 37 | |
| 38 | ```sh |
| 39 | git push https://g1t.sh/<workspace>/new-repo.git main |
| 40 | ``` |
| 41 | |
| 42 | ## Private repositories |
| 43 | |
| 44 | A private repository is visible only to members of its workspace. To |
| 45 | everyone else it looks exactly like a repository that does not exist, both |
| 46 | on the site and to git. |
| 47 | |
| 48 | ## Protected branches |
| 49 | |
| 50 | A repository can protect its default branch under **Settings**. Pushing to |
| 51 | it is then refused, for members and agents alike, and git says why: |
| 52 | |
| 53 | ```text |
| 54 | ! [remote rejected] main -> main (main is protected: push a branch and open a pull request) |
| 55 | ``` |
| 56 | |
| 57 | Changes reach a protected branch only by merging a pull request. The first |
| 58 | push to an empty repository is still allowed. |
| 59 | |
| 60 | ## Branches |
| 61 | |
| 62 | Push any branch to a repository you can write to, and open a |
| 63 | [pull request](/concepts/overview/#pull-requests) from it on the |
| 64 | repository's **Pull requests** tab. |
| 65 | |
| 66 | ```sh |
| 67 | git switch -c my-change |
| 68 | git push origin my-change |
| 69 | ``` |
| 70 | |
| 71 | ## Pull request forks |
| 72 | |
| 73 | A pull request that was not opened from a branch has its own remote: |
| 74 | |
| 75 | ```text |
| 76 | https://g1t.sh/pulls/<pull request id>.git |
| 77 | ``` |
| 78 | |
| 79 | Only whoever opened the pull request can push to it. Pushes to a fork |
| 80 | update the pull request's head commit on its page. |
| 81 | |
| 82 | ## Limits |
| 83 | |
| 84 | Repositories are stored in Cloudflare Artifacts, which limits a repository to |
| 85 | 1 GB and a single file to 32 MB. A single push is limited to 100 MB. |
| 86 | |
| 87 | ## SSH |
| 88 | |
| 89 | Git over SSH is not available yet. Use HTTPS. |