Skip to content
493 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, and the [member privileges](/guides/workspaces/#member-privileges) to allow it, or an owner |
114| Archive or unarchive | Admin |
115| [Transfer](/guides/transferring-repositories/) | An owner of its workspace, or a member with Admin when the member privileges allow it; and in the other workspace, being able to create a repository |
116| Delete | An owner of its workspace, or a member with Admin when the member privileges allow it |
117| Restore and purge | An owner of its workspace |
118| See the Recently deleted list | An owner of its workspace |
119
120Renaming the repository or its default branch, changing its visibility
121and archiving it are done by a person, not a workspace token.
122g1t's token can never use the tools that make these changes,
123whatever its run. See [credentials](/guides/working-with-g1t/#credentials).
124
125## Edit the details
126
1271. Open the repository's **Settings → Repository**.
1282. Under **Details**, change **Description**, **Website** or **Topics**.
1293. Choose **Save**.
130
131| Field | Rules |
132| --- | --- |
133| Description | Up to 200 characters. Empty clears it. |
134| Website | An http or https address. `https://` is added when you leave the scheme out. Empty clears it. |
135| Topics | Lowercase letters, digits and hyphens, at most 20, each up to 35 characters. Separate them with commas or spaces. |
136
137From the API, call
138[`PATCH /repos/{owner}/{name}`](/reference/api/repositories/update-repo/)
139with the fields to change. Fields you leave out stay as they are.
140
141```sh
142curl -X PATCH https://api.g1t.sh/repos/acme/rocket \
143 -H "Authorization: Bearer $G1T_TOKEN" \
144 -H "Content-Type: application/json" \
145 -d '{"description": "Launches things.", "website": "rocket.acme.dev", "topics": ["cli", "rust"]}'
146```
147
148Over MCP, it is the `repository` tool's `update` action, with `repo` and
149the same fields.
150
151## Change the default branch
152
153The default branch is what the repository opens on, what new clones check
154out, what pull requests target, and what branch protection covers.
155
1561. Open the repository's **Settings → Repository**.
1572. Under **Branches → Default branch**, pick another branch.
1583. Choose **Change default branch**.
159
160The branch must already exist; push it first. When you change it:
161
162- Open pull requests merge into the new default branch.
163- New clones check out the new default branch. Existing clones keep the
164 branches they have; run `git remote set-head origin -a` to update what
165 `origin/HEAD` points at.
166- [Branch protection](/guides/git/#protected-branches) covers the new
167 default branch.
168
169From the API, send `default_branch` to
170[`PATCH /repos/{owner}/{name}`](/reference/api/repositories/update-repo/):
171
172```sh
173curl -X PATCH https://api.g1t.sh/repos/acme/rocket \
174 -H "Authorization: Bearer $G1T_TOKEN" \
175 -H "Content-Type: application/json" \
176 -d '{"default_branch": "trunk"}'
177```
178
179Over MCP, it is the `repository` tool's `update` action, with `repo` and
180`default_branch`. When the
181same call changes other fields, they are changed first.
182
183## Rename a branch
184
1851. Open the repository's **Settings → Repository**.
1862. Under **Branches → Rename a branch**, pick the **Branch** and type its
187 **New name**.
1883. Choose **Rename branch**.
189
190Renaming the default branch needs Admin. It stays the default under its
191new name. When a branch is renamed:
192
193- Open pull requests from it follow it to the new name.
194- Web addresses that name the old branch, such as
195 `g1t.sh/acme/rocket/tree/old-name`, redirect to the new one until a
196 branch with the old name is made again.
197- Git remotes do not follow. In each clone, rename the local branch and
198 track the new one:
199
200```sh
201git branch -m old-name new-name
202git fetch origin
203git branch -u origin/new-name new-name
204git remote set-head origin -a
205```
206
207From the API, call
208[`POST /repos/{owner}/{name}/branches/{branch}/rename`](/reference/api/repositories/rename-branch/)
209with `new_name`. A branch name with slashes goes in the path URL-encoded,
210as one segment: `feature/login` is `feature%2Flogin`.
211
212```sh
213curl -X POST https://api.g1t.sh/repos/acme/rocket/branches/feature%2Flogin/rename \
214 -H "Authorization: Bearer $G1T_TOKEN" \
215 -H "Content-Type: application/json" \
216 -d '{"new_name": "feature/sign-in"}'
217```
218
219Over MCP, it is the `repository` tool's `rename_branch` action, with
220`repo`, `branch` and `new_name`.
221
222## Rename a repository
223
2241. Open the repository's **Settings → Repository**.
2252. Under **Name**, type the new name. It shows the new address.
2263. Choose **Rename**.
227
228A name is lowercase letters, digits, dots, hyphens and underscores, up to
229100 characters. It cannot start with a dot or end in `.git`, and no other
230repository in the workspace may have it, including one that was
231[recently deleted](#restore-a-repository).
232
233Everything stays with the repository: its git data, issues, pull requests,
234workflow runs, deployments, settings, secrets and webhooks. Its old address
235keeps working, the same way as after a
236[transfer](/guides/transferring-repositories/#old-addresses):
237
238| | Behaviour |
239| --- | --- |
240| Web pages | A permanent redirect (`301`) to the same page at the new address. |
241| `git clone`, `fetch`, `pull` and `push` | Redirected to the new remote. Git follows it and prints a warning each time. |
242| API and MCP | A call that names the repository by its old name runs against it under its new name. |
243
244Its project follows: a project that had the repository's name takes the
245new one, unless another project in the workspace already has it, and its
246deployed apps are built again under the new name while the old addresses
247redirect.
248
249A redirect stops as soon as a repository is made at the old address.
250Update your remotes rather than relying on it:
251
252```sh
253git remote set-url origin https://g1t.sh/acme/launcher.git
254```
255
256From the API, call
257[`POST /repos/{owner}/{name}/rename`](/reference/api/repositories/rename-repo/)
258with `name`:
259
260```sh
261curl -X POST https://api.g1t.sh/repos/acme/rocket/rename \
262 -H "Authorization: Bearer $G1T_TOKEN" \
263 -H "Content-Type: application/json" \
264 -d '{"name": "launcher"}'
265```
266
267Over MCP, it is the `repository` tool's `rename` action, with `repo` and
268`name`.
269
270## Change who can see a repository
271
272A public repository can be seen and cloned by anyone, signed in or not. A
273private one can be seen only by people with a
274[role](/guides/access-and-roles/) on it.
275
2761. Open the repository's **Settings → Repository**.
2772. Under **Danger zone → Change visibility**, choose **Make private** or
278 **Make public**.
2793. Read what changes, type the repository's full name (`<workspace>/<repo>`)
280 to confirm, and choose **Make private** or **Make public** again.
281
282| | Making it public | Making it private |
283| --- | --- | --- |
284| 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. |
285| Search and Explore | It is added to [search](/guides/search/) and Explore for everyone. | It leaves search and Explore for everyone outside the workspace. |
286| Link previews | Links to it show a preview card with its name and description. | Links to it stop showing a preview card. |
287| 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). |
288
289Nothing else changes: its address, members, settings, secrets, webhooks
290and deployments stay as they are.
291
292From the API, call
293[`POST /repos/{owner}/{name}/visibility`](/reference/api/repositories/set-repo-visibility/)
294with `private` and its full name in `confirm`:
295
296```sh
297curl -X POST https://api.g1t.sh/repos/acme/rocket/visibility \
298 -H "Authorization: Bearer $G1T_TOKEN" \
299 -H "Content-Type: application/json" \
300 -d '{"private": true, "confirm": "acme/rocket"}'
301```
302
303Over MCP, it is the `repository` tool's `set_visibility` action, with
304`repo`, `private` and `confirm`. `private` on
305[`PATCH /repos/{owner}/{name}`](/reference/api/repositories/update-repo/)
306makes the same change without the confirmation, for people with Admin.
307
308## Archive a repository
309
310Archiving makes a repository read-only. Use it for work that is finished
311but should stay readable.
312
3131. Open the repository's **Settings → Repository**.
3142. Under **Danger zone**, choose **Archive**.
3153. Read what changes and choose **Archive** again.
316
317While it is archived:
318
319| | |
320| --- | --- |
321| Pushes and merges | Refused, whatever your role, and for agents too. |
322| Issues and pull requests | Locked. They stay readable. |
323| Agents and workflows | Do not run. |
324| Settings | The ones that change the repository are turned off. |
325| Deployments | Keep serving. |
326| Who can see it | Unchanged. Anyone who could see it still can, and clone it. |
327
328Its page says it is archived, and so do its project's card on the
329workspace overview and its card on [Explore](/guides/search/#explore),
330with an **archived** label. To undo it, someone with Admin chooses **Unarchive**
331in the same place. Pushes, merges, issues, pull requests, agents and
332workflows work again; nothing that was refused while it was archived runs
333by itself.
334
335From the API, call
336[`POST /repos/{owner}/{name}/archive`](/reference/api/repositories/archive-repo/)
337or
338[`POST /repos/{owner}/{name}/unarchive`](/reference/api/repositories/unarchive-repo/):
339
340```sh
341curl -X POST https://api.g1t.sh/repos/acme/rocket/archive \
342 -H "Authorization: Bearer $G1T_TOKEN"
343```
344
345Over MCP, they are the `repository` tool's `archive` and `unarchive`
346actions, with `repo`. The
347repository's `archived_at` field says when it was archived, and is null
348when it is not.
349
350## Delete a repository
351
352Deleting takes a repository away at once, but an owner can restore it for
35330 days. After that it is purged: removed for good, its git data with it.
354
3551. Open the repository's **Settings → Repository**.
3562. Under **Danger zone**, choose **Delete**.
3573. Read what happens, type the repository's full name
358 (`<workspace>/<repo>`) to confirm, and choose **Delete repository**.
359
360| | While it is deleted | When it is purged |
361| --- | --- | --- |
362| Its pages, git remote and API | Answer as if it did not exist, for everyone. | The same. |
363| Its name | Stays taken: no repository can be made at its address. | Free to use again. |
364| Agents and workflows | Stop, and do not start. | |
365| Deployments | Taken down. Its `g1t.page` addresses stop serving. | Removed. |
366| Custom domains | Kept, and serve nothing. | Removed. |
367| Search | Drops it. | |
368| Webhooks | The workspace's webhooks are sent `repo.deleted`. | Sent `repo.purged`. |
369| Storage | Stops counting toward the workspace's storage. | |
370| Git data, issues, pull requests, settings, secrets | Kept, for restoring. | Removed, and cannot be recovered. |
371
372Its entries in the [audit log](/guides/audit-log/) are kept, as for
373anything else.
374
375From the API, call
376[`DELETE /repos/{owner}/{name}`](/reference/api/repositories/delete-repo/)
377with its full name in `confirm`. It returns the deleted repository with
378`purge_after`, when it will be purged:
379
380```sh
381curl -X DELETE https://api.g1t.sh/repos/acme/rocket \
382 -H "Authorization: Bearer $G1T_TOKEN" \
383 -H "Content-Type: application/json" \
384 -d '{"confirm": "acme/rocket"}'
385```
386
387Over MCP, it is the `repository` tool's `delete` action, with `repo` and
388`confirm`.
389
390To move a repository to another workspace instead of deleting it, see
391[transferring a repository](/guides/transferring-repositories/).
392
393## Restore a repository
394
395A workspace's recently deleted repositories are listed for its owners
396under **Recently deleted** in the workspace's **Settings → Repositories**,
397at `g1t.sh/<workspace>/-/repositories`, each with who deleted it and when
398it will be purged.
399
4001. Open the workspace's **Settings → Repositories**.
4012. Under **Recently deleted**, find the repository and choose **Restore**.
402
403It comes back at the address it had, as it was when it was deleted: git
404data, issues, pull requests, settings, secrets and webhooks. Its
405deployments are built again, and its custom domains serve them once they
406are live. Agents and workflows run again for new work; they do not catch
407up on what they missed.
408
409From the API, list them with
410[`GET /workspaces/{workspace}/repos/deleted`](/reference/api/repositories/list-deleted-repos/)
411(the `repository` tool's `list_deleted` action over MCP), then call
412[`POST /repos/{owner}/{name}/restore`](/reference/api/repositories/restore-repo/)
413with the path it had (the `restore` action):
414
415```sh
416curl https://api.g1t.sh/workspaces/acme/repos/deleted \
417 -H "Authorization: Bearer $G1T_TOKEN"
418
419curl -X POST https://api.g1t.sh/repos/acme/rocket/restore \
420 -H "Authorization: Bearer $G1T_TOKEN"
421```
422
423### Purge a repository now
424
425To remove a deleted repository for good before its 30 days are up, and
426free its name:
427
4281. Open the workspace's **Settings → Repositories**.
4292. Under **Recently deleted**, choose **Delete permanently** beside it.
4303. Type its full name (`<workspace>/<repo>`) to confirm, and choose
431 **Delete permanently** again.
432
433This cannot be undone. From the API, call
434[`POST /repos/{owner}/{name}/purge`](/reference/api/repositories/purge-repo/)
435with its full name in `confirm`:
436
437```sh
438curl -X POST https://api.g1t.sh/repos/acme/rocket/purge \
439 -H "Authorization: Bearer $G1T_TOKEN" \
440 -H "Content-Type: application/json" \
441 -d '{"confirm": "acme/rocket"}'
442```
443
444Over MCP, it is the `repository` tool's `purge` action, with `repo` and
445`confirm`.
446
447A workspace whose only repositories are recently deleted ones can itself
448be [deleted](/guides/workspaces/#delete-a-workspace); they are purged with
449it.
450
451## When a change is refused
452
453| Response | Why | What to do |
454| --- | --- | --- |
455| `401 unauthenticated` | No token, or one that is not valid. | Send a personal access token. |
456| `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. |
457| `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. |
458| `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. |
459| `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. |
460| `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. |
461
462Each refusal comes with a message that says what to do.
463
464## From the API and MCP
465
466| Route | MCP | What it does |
467| --- | --- | --- |
468| [`GET /repos/{owner}/{name}/languages`](/reference/api/repository-insights/get-languages/) | `repository` `languages` | Its languages by bytes, with `color` and `percent`. |
469| [`GET /repos/{owner}/{name}/contributors`](/reference/api/repository-insights/list-contributors/) | `repository` `contributors` | Its contributors with `kind`, `commits` and `weeks`. |
470| [`GET /repos/{owner}/{name}/license`](/reference/api/repository-insights/get-license/) | `repository` `license` | Its license's `spdx_id`, `name` and `path`. |
471| [`GET /repos/{owner}/{name}/stargazers`](/reference/api/stars/list-stargazers/) | `repository` `stargazers` | Who starred it, newest first. |
472| [`PUT /user/starred/{owner}/{name}`](/reference/api/stars/star-repo/) | `repository` `star` | Star it. `DELETE` takes the star back; `GET` says whether you did. |
473| [`GET /user/starred`](/reference/api/stars/list-starred/) | `repository` `list_starred` | What you starred. |
474
475Answers read from the default branch say which `commit` they are for and
476the `head` now; `pending` is true until the first is read. Stars take the
477`account:read` and `account:write` scopes; the rest `repo:read`.
478
479## Events and the audit log
480
481Each change is sent to [webhooks](/guides/webhooks/#events) and recorded
482in the [audit log](/guides/audit-log/):
483
484| Change | Event |
485| --- | --- |
486| Description, website, topics, protection | `repo.updated` |
487| Visibility | `repo.visibility_changed` |
488| Rename | `repo.renamed` |
489| Default branch | `repo.default_branch_changed` |
490| Branch rename | `branch.renamed` |
491| Archive, unarchive | `repo.archived`, `repo.unarchived` |
492| Transfer | `repo.transferred` |
493| Delete, restore, purge | `repo.deleted`, `repo.restored`, `repo.purged` |