Skip to content
492 linesCodeBlameRaw
1---
2title: Managing a repository
3description: What a repository's About shows, and how to rename it or a branch, change its default branch, website and topics, make it public or private, archive it, and delete and restore it.
4---
5
6A repository's details and its lifecycle are managed from its
7**Settings → Repository** page, at
8`g1t.sh/<workspace>/<repo>/settings/repository`, and from the API and MCP
9server. This guide covers each change, who can make it, and what happens
10when you do.
11
12## The About beside the files
13
14A repository's **Code** page shows its files with an **About** beside them,
15the way most code hosts lay it out. On a phone it comes after the files.
16
17| Part | What it shows |
18| --- | --- |
19| Description, website, topics | What you set under [Edit the details](#edit-the-details). |
20| **Readme** | A link to the README shown under the files. |
21| **License** | The license its `LICENSE` file holds, such as **MIT license**, linked to the file. **View license** when the text is not one g1t recognizes. `LICENCE`, `COPYING` and `UNLICENSE` are read too, with or without an extension, and an `SPDX-License-Identifier` line says it outright. |
22| **Security policy** | A link to `SECURITY.md` at the root, or in `.g1t`, `.github` or `docs`. |
23| **Activity** | The repository's [activity](#activity): pushes, merges, new branches and tags. |
24| **Stars**, **watching** | How many people [starred](#stars) it, and how many watch all or some of its activity from the [Watch menu](/guides/inbox/). |
25| **Releases** | How many [releases](/guides/releases/) it has and the latest, or **Create a new release** for people who can push. |
26| **Packages** | [Packages](/guides/packages/) linked to it, or how to publish the first. |
27| **Contributors** | How many people and agents made it, and the most active. See [contributors](#contributors). |
28| **Languages** | The languages it is written in, by bytes. See [languages](#languages). |
29
30The license, security policy, languages and contributors are read from the
31default branch in the background each time it moves, and kept by commit, so
32the page never waits for them. A repository pushed to for the first time
33shows **Reading the default branch…** for a few seconds.
34
35### Languages
36
37The bar counts the bytes of each language's files on the default branch.
38Programming and markup languages count; data such as JSON and YAML, and
39prose such as Markdown, do not. Neither do:
40
41| Files | Such as |
42| --- | --- |
43| Vendored | `node_modules/`, `vendor/`, `third_party/`, minified jQuery, and anything under a dot-directory such as `.github/` |
44| Generated | `dist/`, `*.min.js`, `*.pb.go`, lockfiles |
45| Documentation | `docs/`, `doc/`, `examples/` |
46
47Change what counts with `linguist-*` attributes in the repository's
48`.gitattributes` file at the root. A later line wins over an earlier one.
49
50```text
51vendor/ours/** -linguist-vendored
52*.gen.ts linguist-generated
53docs/** -linguist-documentation
54*.inc linguist-language=PHP
55*.sql linguist-detectable
56```
57
58A repository too large to read in full (more than 10,000 files) counts the
59files read.
60
61### Contributors
62
63**Insights → Contributors** lists everyone whose commits are on the default
64branch, most commits first, with their commits by week, and the
65repository's commits per week over the last year.
66
67| Who | How they are matched |
68| --- | --- |
69| A person | By an address they confirmed on their account, or their noreply address. Several addresses of one account count as one. |
70| g1t | Its own commits, by its address. |
71| Anyone else | By the name on their commits. |
72
73The newest 3,000 commits are counted.
74
75### Activity
76
77**Insights → Activity** lists, newest first, who pushed to which branch,
78created a branch or tag, merged a pull request, renamed a branch or changed
79the default branch, person or agent.
80
81### Stars
82
83Choose **Star** in the repository's header to keep it in your profile's
84**Stars** tab, at `g1t.sh/u/<you>?tab=stars`. The number beside it leads
85to who starred it. Anyone signed in who can read a repository can star it;
86stars on a private repository are seen only by people who can read it.
87
88## The settings page
89
90| Section | What it holds |
91| --- | --- |
92| **Name** | The repository's name, the second part of its address. |
93| **Details** | Its description, website and topics, shown on its page, in [search and Explore](/guides/search/). |
94| **Branches** | The default branch, renaming a branch, and a link to **Branches and merging**: [branch protection](/guides/git/#protected-branches), [required status checks](/guides/pull-requests/#required-status-checks), required approvals, the [merge queue](/guides/merge-queue/) and what agents do. What a sandbox may reach is under **Guardrails**; see [guardrails](/guides/guardrails/). |
95| **Artifacts** | How many days the files workflow runs upload are kept, 1 to 90 (14 unless changed). See [artifacts](/guides/actions/#artifacts). |
96| **Danger zone** | Change visibility, archive, [transfer](/guides/transferring-repositories/) and delete. Shown to people with the Admin role. |
97
98While a repository is [archived](#archive-a-repository), the settings that
99change it are turned off until it is unarchived.
100
101## Who can do what
102
103Each change needs a [role](/guides/access-and-roles/) on the repository.
104Owners of its workspace have Admin on it.
105
106| Change | Needs |
107| --- | --- |
108| Description, website, topics | Maintain |
109| How long artifacts are kept | Maintain |
110| Default branch | Admin |
111| Rename a branch | Write; Admin for the default branch |
112| Rename the repository | Admin |
113| Make it public or private | Admin |
114| Archive or unarchive | Admin |
115| [Transfer](/guides/transferring-repositories/) | An owner of both workspaces |
116| Delete, restore and purge | An owner of its workspace |
117| See the Recently deleted list | An owner of its workspace |
118
119Renaming the repository or its default branch, changing its visibility
120and archiving it are done by a person, not a workspace token.
121g1t's token can never use the tools that make these changes,
122whatever its run. See [credentials](/guides/working-with-g1t/#credentials).
123
124## Edit the details
125
1261. Open the repository's **Settings → Repository**.
1272. Under **Details**, change **Description**, **Website** or **Topics**.
1283. Choose **Save**.
129
130| Field | Rules |
131| --- | --- |
132| Description | Up to 200 characters. Empty clears it. |
133| Website | An http or https address. `https://` is added when you leave the scheme out. Empty clears it. |
134| Topics | Lowercase letters, digits and hyphens, at most 20, each up to 35 characters. Separate them with commas or spaces. |
135
136From the API, call
137[`PATCH /repos/{owner}/{name}`](/reference/api/repositories/update-repo/)
138with the fields to change. Fields you leave out stay as they are.
139
140```sh
141curl -X PATCH https://api.g1t.sh/repos/acme/rocket \
142 -H "Authorization: Bearer $G1T_TOKEN" \
143 -H "Content-Type: application/json" \
144 -d '{"description": "Launches things.", "website": "rocket.acme.dev", "topics": ["cli", "rust"]}'
145```
146
147Over MCP, it is the `repository` tool's `update` action, with `repo` and
148the same fields.
149
150## Change the default branch
151
152The default branch is what the repository opens on, what new clones check
153out, what pull requests target, and what branch protection covers.
154
1551. Open the repository's **Settings → Repository**.
1562. Under **Branches → Default branch**, pick another branch.
1573. Choose **Change default branch**.
158
159The branch must already exist; push it first. When you change it:
160
161- Open pull requests merge into the new default branch.
162- New clones check out the new default branch. Existing clones keep the
163 branches they have; run `git remote set-head origin -a` to update what
164 `origin/HEAD` points at.
165- [Branch protection](/guides/git/#protected-branches) covers the new
166 default branch.
167
168From the API, send `default_branch` to
169[`PATCH /repos/{owner}/{name}`](/reference/api/repositories/update-repo/):
170
171```sh
172curl -X PATCH https://api.g1t.sh/repos/acme/rocket \
173 -H "Authorization: Bearer $G1T_TOKEN" \
174 -H "Content-Type: application/json" \
175 -d '{"default_branch": "trunk"}'
176```
177
178Over MCP, it is the `repository` tool's `update` action, with `repo` and
179`default_branch`. When the
180same call changes other fields, they are changed first.
181
182## Rename a branch
183
1841. Open the repository's **Settings → Repository**.
1852. Under **Branches → Rename a branch**, pick the **Branch** and type its
186 **New name**.
1873. Choose **Rename branch**.
188
189Renaming the default branch needs Admin. It stays the default under its
190new name. When a branch is renamed:
191
192- Open pull requests from it follow it to the new name.
193- Web addresses that name the old branch, such as
194 `g1t.sh/acme/rocket/tree/old-name`, redirect to the new one until a
195 branch with the old name is made again.
196- Git remotes do not follow. In each clone, rename the local branch and
197 track the new one:
198
199```sh
200git branch -m old-name new-name
201git fetch origin
202git branch -u origin/new-name new-name
203git remote set-head origin -a
204```
205
206From the API, call
207[`POST /repos/{owner}/{name}/branches/{branch}/rename`](/reference/api/repositories/rename-branch/)
208with `new_name`. A branch name with slashes goes in the path URL-encoded,
209as one segment: `feature/login` is `feature%2Flogin`.
210
211```sh
212curl -X POST https://api.g1t.sh/repos/acme/rocket/branches/feature%2Flogin/rename \
213 -H "Authorization: Bearer $G1T_TOKEN" \
214 -H "Content-Type: application/json" \
215 -d '{"new_name": "feature/sign-in"}'
216```
217
218Over MCP, it is the `repository` tool's `rename_branch` action, with
219`repo`, `branch` and `new_name`.
220
221## Rename a repository
222
2231. Open the repository's **Settings → Repository**.
2242. Under **Name**, type the new name. It shows the new address.
2253. Choose **Rename**.
226
227A name is lowercase letters, digits, dots, hyphens and underscores, up to
228100 characters. It cannot start with a dot or end in `.git`, and no other
229repository in the workspace may have it, including one that was
230[recently deleted](#restore-a-repository).
231
232Everything stays with the repository: its git data, issues, pull requests,
233workflow runs, deployments, settings, secrets and webhooks. Its old address
234keeps working, the same way as after a
235[transfer](/guides/transferring-repositories/#old-addresses):
236
237| | Behaviour |
238| --- | --- |
239| Web pages | A permanent redirect (`301`) to the same page at the new address. |
240| `git clone`, `fetch`, `pull` and `push` | Redirected to the new remote. Git follows it and prints a warning each time. |
241| API and MCP | A call that names the repository by its old name runs against it under its new name. |
242
243Its project follows: a project that had the repository's name takes the
244new one, unless another project in the workspace already has it, and its
245deployed apps are built again under the new name while the old addresses
246redirect.
247
248A redirect stops as soon as a repository is made at the old address.
249Update your remotes rather than relying on it:
250
251```sh
252git remote set-url origin https://g1t.sh/acme/launcher.git
253```
254
255From the API, call
256[`POST /repos/{owner}/{name}/rename`](/reference/api/repositories/rename-repo/)
257with `name`:
258
259```sh
260curl -X POST https://api.g1t.sh/repos/acme/rocket/rename \
261 -H "Authorization: Bearer $G1T_TOKEN" \
262 -H "Content-Type: application/json" \
263 -d '{"name": "launcher"}'
264```
265
266Over MCP, it is the `repository` tool's `rename` action, with `repo` and
267`name`.
268
269## Change who can see a repository
270
271A public repository can be seen and cloned by anyone, signed in or not. A
272private one can be seen only by people with a
273[role](/guides/access-and-roles/) on it.
274
2751. Open the repository's **Settings → Repository**.
2762. Under **Danger zone → Change visibility**, choose **Make private** or
277 **Make public**.
2783. Read what changes, type the repository's full name (`<workspace>/<repo>`)
279 to confirm, and choose **Make private** or **Make public** again.
280
281| | Making it public | Making it private |
282| --- | --- | --- |
283| Who can see it | Anyone: its code, issues and pull requests, and cloning it, without signing in. | Only people with a role on it: its workspace's owners, its members (unless the [base permission](/guides/access-and-roles/#the-base-permission) is None), and anyone given a role on it. Anyone else gets a page that says it does not exist. |
284| Search and Explore | It is added to [search](/guides/search/) and Explore for everyone. | It leaves search and Explore for everyone outside the workspace. |
285| Link previews | Links to it show a preview card with its name and description. | Links to it stop showing a preview card. |
286| Storage | It stops counting toward the workspace's private storage. | It counts toward the workspace's private storage. A free workspace has 1 GB; making it private is refused when that would go over. See [what is free](/guides/usage-and-billing/#what-is-free). |
287
288Nothing else changes: its address, members, settings, secrets, webhooks
289and deployments stay as they are.
290
291From the API, call
292[`POST /repos/{owner}/{name}/visibility`](/reference/api/repositories/set-repo-visibility/)
293with `private` and its full name in `confirm`:
294
295```sh
296curl -X POST https://api.g1t.sh/repos/acme/rocket/visibility \
297 -H "Authorization: Bearer $G1T_TOKEN" \
298 -H "Content-Type: application/json" \
299 -d '{"private": true, "confirm": "acme/rocket"}'
300```
301
302Over MCP, it is the `repository` tool's `set_visibility` action, with
303`repo`, `private` and `confirm`. `private` on
304[`PATCH /repos/{owner}/{name}`](/reference/api/repositories/update-repo/)
305makes the same change without the confirmation, for people with Admin.
306
307## Archive a repository
308
309Archiving makes a repository read-only. Use it for work that is finished
310but should stay readable.
311
3121. Open the repository's **Settings → Repository**.
3132. Under **Danger zone**, choose **Archive**.
3143. Read what changes and choose **Archive** again.
315
316While it is archived:
317
318| | |
319| --- | --- |
320| Pushes and merges | Refused, whatever your role, and for agents too. |
321| Issues and pull requests | Locked. They stay readable. |
322| Agents and workflows | Do not run. |
323| Settings | The ones that change the repository are turned off. |
324| Deployments | Keep serving. |
325| Who can see it | Unchanged. Anyone who could see it still can, and clone it. |
326
327Its page says it is archived, and so do its project's card on the
328workspace overview and its card on [Explore](/guides/search/#explore),
329with an **archived** label. To undo it, someone with Admin chooses **Unarchive**
330in the same place. Pushes, merges, issues, pull requests, agents and
331workflows work again; nothing that was refused while it was archived runs
332by itself.
333
334From the API, call
335[`POST /repos/{owner}/{name}/archive`](/reference/api/repositories/archive-repo/)
336or
337[`POST /repos/{owner}/{name}/unarchive`](/reference/api/repositories/unarchive-repo/):
338
339```sh
340curl -X POST https://api.g1t.sh/repos/acme/rocket/archive \
341 -H "Authorization: Bearer $G1T_TOKEN"
342```
343
344Over MCP, they are the `repository` tool's `archive` and `unarchive`
345actions, with `repo`. The
346repository's `archived_at` field says when it was archived, and is null
347when it is not.
348
349## Delete a repository
350
351Deleting takes a repository away at once, but an owner can restore it for
35230 days. After that it is purged: removed for good, its git data with it.
353
3541. Open the repository's **Settings → Repository**.
3552. Under **Danger zone**, choose **Delete**.
3563. Read what happens, type the repository's full name
357 (`<workspace>/<repo>`) to confirm, and choose **Delete repository**.
358
359| | While it is deleted | When it is purged |
360| --- | --- | --- |
361| Its pages, git remote and API | Answer as if it did not exist, for everyone. | The same. |
362| Its name | Stays taken: no repository can be made at its address. | Free to use again. |
363| Agents and workflows | Stop, and do not start. | |
364| Deployments | Taken down. Its `g1t.page` addresses stop serving. | Removed. |
365| Custom domains | Kept, and serve nothing. | Removed. |
366| Search | Drops it. | |
367| Webhooks | The workspace's webhooks are sent `repo.deleted`. | Sent `repo.purged`. |
368| Storage | Stops counting toward the workspace's storage. | |
369| Git data, issues, pull requests, settings, secrets | Kept, for restoring. | Removed, and cannot be recovered. |
370
371Its entries in the [audit log](/guides/audit-log/) are kept, as for
372anything else.
373
374From the API, call
375[`DELETE /repos/{owner}/{name}`](/reference/api/repositories/delete-repo/)
376with its full name in `confirm`. It returns the deleted repository with
377`purge_after`, when it will be purged:
378
379```sh
380curl -X DELETE https://api.g1t.sh/repos/acme/rocket \
381 -H "Authorization: Bearer $G1T_TOKEN" \
382 -H "Content-Type: application/json" \
383 -d '{"confirm": "acme/rocket"}'
384```
385
386Over MCP, it is the `repository` tool's `delete` action, with `repo` and
387`confirm`.
388
389To move a repository to another workspace instead of deleting it, see
390[transferring a repository](/guides/transferring-repositories/).
391
392## Restore a repository
393
394A workspace's recently deleted repositories are listed for its owners
395under **Recently deleted** in the workspace's **Settings → Repositories**,
396at `g1t.sh/<workspace>/-/repositories`, each with who deleted it and when
397it will be purged.
398
3991. Open the workspace's **Settings → Repositories**.
4002. Under **Recently deleted**, find the repository and choose **Restore**.
401
402It comes back at the address it had, as it was when it was deleted: git
403data, issues, pull requests, settings, secrets and webhooks. Its
404deployments are built again, and its custom domains serve them once they
405are live. Agents and workflows run again for new work; they do not catch
406up on what they missed.
407
408From the API, list them with
409[`GET /workspaces/{workspace}/repos/deleted`](/reference/api/repositories/list-deleted-repos/)
410(the `repository` tool's `list_deleted` action over MCP), then call
411[`POST /repos/{owner}/{name}/restore`](/reference/api/repositories/restore-repo/)
412with the path it had (the `restore` action):
413
414```sh
415curl https://api.g1t.sh/workspaces/acme/repos/deleted \
416 -H "Authorization: Bearer $G1T_TOKEN"
417
418curl -X POST https://api.g1t.sh/repos/acme/rocket/restore \
419 -H "Authorization: Bearer $G1T_TOKEN"
420```
421
422### Purge a repository now
423
424To remove a deleted repository for good before its 30 days are up, and
425free its name:
426
4271. Open the workspace's **Settings → Repositories**.
4282. Under **Recently deleted**, choose **Delete permanently** beside it.
4293. Type its full name (`<workspace>/<repo>`) to confirm, and choose
430 **Delete permanently** again.
431
432This cannot be undone. From the API, call
433[`POST /repos/{owner}/{name}/purge`](/reference/api/repositories/purge-repo/)
434with its full name in `confirm`:
435
436```sh
437curl -X POST https://api.g1t.sh/repos/acme/rocket/purge \
438 -H "Authorization: Bearer $G1T_TOKEN" \
439 -H "Content-Type: application/json" \
440 -d '{"confirm": "acme/rocket"}'
441```
442
443Over MCP, it is the `repository` tool's `purge` action, with `repo` and
444`confirm`.
445
446A workspace whose only repositories are recently deleted ones can itself
447be [deleted](/guides/workspaces/#delete-a-workspace); they are purged with
448it.
449
450## When a change is refused
451
452| Response | Why | What to do |
453| --- | --- | --- |
454| `401 unauthenticated` | No token, or one that is not valid. | Send a personal access token. |
455| `403 forbidden` | You are not an owner, for a change that needs one; or g1t's token was used. | Ask an owner of the workspace. |
456| `404 not_found` | No such repository or branch, or you cannot see it. For restore and purge: no deleted repository had that path, or it was purged. | Check the path. A deleted repository is named by the path it had. |
457| `409 conflict` | The new name is taken in the workspace, by a repository or a recently deleted one; or a branch with the new name exists. | Pick another name, or purge the deleted repository first. |
458| `422 invalid` | `confirm` is not the repository's full name; the name, branch name or website is not valid; or the new default branch does not exist. | Type `<workspace>/<repo>` exactly; push the branch first. |
459| `402 payment_required` | Making it private would take a free workspace's private storage over 1 GB. | Start [the g1t plan](/guides/usage-and-billing/#the-g1t-plan), or make room first. |
460
461Each refusal comes with a message that says what to do.
462
463## From the API and MCP
464
465| Route | MCP | What it does |
466| --- | --- | --- |
467| [`GET /repos/{owner}/{name}/languages`](/reference/api/repository-insights/get-languages/) | `repository` `languages` | Its languages by bytes, with `color` and `percent`. |
468| [`GET /repos/{owner}/{name}/contributors`](/reference/api/repository-insights/list-contributors/) | `repository` `contributors` | Its contributors with `kind`, `commits` and `weeks`. |
469| [`GET /repos/{owner}/{name}/license`](/reference/api/repository-insights/get-license/) | `repository` `license` | Its license's `spdx_id`, `name` and `path`. |
470| [`GET /repos/{owner}/{name}/stargazers`](/reference/api/stars/list-stargazers/) | `repository` `stargazers` | Who starred it, newest first. |
471| [`PUT /user/starred/{owner}/{name}`](/reference/api/stars/star-repo/) | `repository` `star` | Star it. `DELETE` takes the star back; `GET` says whether you did. |
472| [`GET /user/starred`](/reference/api/stars/list-starred/) | `repository` `list_starred` | What you starred. |
473
474Answers read from the default branch say which `commit` they are for and
475the `head` now; `pending` is true until the first is read. Stars take the
476`account:read` and `account:write` scopes; the rest `repo:read`.
477
478## Events and the audit log
479
480Each change is sent to [webhooks](/guides/webhooks/#events) and recorded
481in the [audit log](/guides/audit-log/):
482
483| Change | Event |
484| --- | --- |
485| Description, website, topics, protection | `repo.updated` |
486| Visibility | `repo.visibility_changed` |
487| Rename | `repo.renamed` |
488| Default branch | `repo.default_branch_changed` |
489| Branch rename | `branch.renamed` |
490| Archive, unarchive | `repo.archived`, `repo.unarchived` |
491| Transfer | `repo.transferred` |
492| Delete, restore, purge | `repo.deleted`, `repo.restored`, `repo.purged` |