# Repositories

> Create, fork, clone, browse, configure, rename and delete repositories on Tangled.

A Tangled repository is just a git repository on a knot. The knot stores the git data and the repository’s issues and pull requests and your account links you to it as the owner.

## Creating a repository

Head to the [new repository](https://tangled.org/repo/new) page to create a repository. If you control an organization account, the owner selector next to the name lets you create the repository under the organization instead. The name becomes the URL: `https://tangled.org/<owner-handle>/<name>`.

## Where the repository lives

The knot holds the git data, the issues and pull requests. When creating a repository, you can choose a knot to host the repository on:

* **Host with Tangled** on `knot1.tangled.sh`, the default.
* **Self-host your own knot** to keep the data on a server you control. See [Run a knot](/docs/self-hosting/knot/).

Presently, repositories cannot migrate from one knot to another, but this is in the works.

## Forking

**Fork** on a repository opens a similar form with the name and description filled in. Just like the repository creation flow, you can choose a destination knot for the forked repository.

## Importing

**Migrate** (`/repo/migrate`) imports a repository from GitHub or from any git URL. [Importing repositories](/docs/guides/importing/) guide contains more about the importer tool.

## Clone URLs

The **Clone** menu shows two forms of each URL: a human-readable version, typically `<owner handle>/<repo name>`, and a permalink version, that uses the repository DID. The permalink version continues to work across handle changes and repository renames (although Tangled will do its best to maintain redirects in such cases):

| Transport | Named                                          | Permalink                            |
| --------- | ---------------------------------------------- | ------------------------------------ |
| HTTPS     | `https://tangled.org/alice.tngl.sh/my-project` | `https://tangled.org/did:plc:abc123` |
| SSH       | `git@tangled.org:alice.tngl.sh/my-project`     | `git@tangled.org:did:plc:abc123`     |

The SSH host is the knot’s hostname. For self-hosted knots, the SSH host and port depend on your SSH setup. A trailing `.git` is accepted on the named form but not on the DID form.

Pushing needs an SSH key in your account and push access to the repository. Some refs under `refs/` are reserved by the knot for its own bookkeeping, and pushes to them are refused.

The Clone menu also offers `.tar.gz` and `.zip` archives of the current ref.

## Renaming

**Settings → General → Rename** changes the display name of a repository. Old names will continue to work on the web as well as for clones, they will be simply be redirected. Git remotes will also continue to work across renames.

## Deleting

**Settings → General → Delete** asks you to type the repository name, then asks the knot to delete the repository. This deletes the git data, issues and pull requests on the knot and can’t be undone. It can take a few seconds for the repository to entirely disappear from Tangled.

## URLs

All of these work with any branch, tag or commit as `<ref>`:

| Path                                   | Shows                                   |
| -------------------------------------- | --------------------------------------- |
| `/<owner>/<repo>`                      | Repository index page                   |
| `/<owner>/<repo>/tree/<ref>/<path>`    | A directory                             |
| `/<owner>/<repo>/blob/<ref>/<path>`    | A file                                  |
| `/<owner>/<repo>/raw/<ref>/<path>`     | Raw `text/plain` file contents          |
| `/<owner>/<repo>/history/<ref>/<path>` | Commits that touched a file             |
| `/<owner>/<repo>/commits/<ref>`        | Commit log                              |
| `/<owner>/<repo>/commit/<sha>`         | One commit and its diff                 |
| `/<owner>/<repo>/commit/<sha>.patch`   | The commit as `git format-patch` output |
| `/<owner>/<repo>/commit/<sha>.diff`    | The commit’s diff only                  |
| `/<owner>/<repo>/branches`, `/tags`    | Branches and tags                       |

`.patch` and `.diff` need a full or abbreviated commit hash, not a branch name. They don’t work for a root commit yet, which has no parent to diff against.