g1t/apps/docs/src/content/docs/guides/git.md

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