# Link a repository (/link-a-repository)



A repository belongs to a team through one file at its root, `jinion.config.json`, the way an app names its project
in its own config. Once it is committed, everyone who opens the repository in Jinion is in the same project.

## From the terminal [#from-the-terminal]

```text
/link
```

Pick the workspace, then the project: one of its projects, or a new one for this repository, named after its folder.
Jinion says what linking shares, then writes `jinion.config.json`. Commit it so your team links too.

To set a repository up without opening the app, such as in a script:

```sh title="Terminal"
jinion link
```

It asks the same in a terminal. In a script it takes the only workspace and project there are, and says so when there
are several.

## From the desktop app [#from-the-desktop-app]

Open the **Decisions** page from its icon in the title bar, or **Share decisions with a team…** in the project menu.
Pick the workspace and the project, then **Link this repository**. **Ask the agent to commit it** puts the commit in
your message, to send or change.

## jinion.config.json [#jinionconfigjson]

```json
{
  "$schema": "https://jinion.co/schema/config.json",
  "workspaceId": "ws_84ya6ofombg59c2q",
  "projectId": "prj_47pl5vbcnn5uraps"
}
```

| Field         | What it is                                                                                           |
| ------------- | ---------------------------------------------------------------------------------------------------- |
| `$schema`     | Where editors find [its schema](https://jinion.co/schema/config.json), to check the file as you type |
| `workspaceId` | The workspace, as cloud.jinion.co shows it                                                           |
| `projectId`   | The project this repository is                                                                       |

The ids aren't secrets: Jinion checks who may read the project on every call, so a public repository can commit the file.
It also checks that the clone is the project's repository, by its remote and its first commit: a config copied into
another repository shares nothing from there.

## What Jinion says about a linked repository [#what-jinion-says-about-a-linked-repository]

| You see                                                            | Because                                       | What to do                 |
| ------------------------------------------------------------------ | --------------------------------------------- | -------------------------- |
| `[T] Acme` on the status line, or the team's name in the title bar | You're in the project's workspace             | Nothing                    |
| This project belongs to Acme                                       | You aren't in its workspace                   | Ask to join with `/link`   |
| You asked to join Acme                                             | Your request waits for an admin               | Wait for the email         |
| This jinion.config.json belongs to another repository              | The config was copied from another repository | Link this one with `/link` |

Access is checked again every 10 minutes while Jinion runs, so being let in shows without a restart.
