> ## Documentation Index
> Fetch the complete documentation index at: https://code.storage/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# repo.getRemoteURL()

> Generate secure Git URLs with embedded JWT authentication.

> [!WARNING]
>
> This page documents the earlier Code Storage SDKs: `@pierre/storage`, `pierre-storage`, and
> `code-storage-go`. New code uses the [Pierre SDK](https://code.storage/docs/sdks.md). To move code to the new SDK, use the
> [`pierre-migrate`
> skill](https://github.com/pierrecomputer/skills/tree/main/skills/pierre-migrate).

The SDK automatically creates secure Git URLs with embedded JWT authentication.

```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
// Default: read/write access, 1-year TTL
const url = await repo.getRemoteURL();

// Read-only access with 1-hour TTL
const readOnlyUrl = await repo.getRemoteURL({
  permissions: ['git:read'],
  ttl: 3600,
});

// CI/CD pipeline with extended permissions
const ciUrl = await repo.getRemoteURL({
  permissions: ['git:read', 'git:write'],
  ttl: 86400, // 24 hours
});

// Disable force push on every branch
const safePushUrl = await repo.getRemoteURL({
  refPolicies: [{ pattern: 'refs/heads/*', ops: ['no-force-push'] }],
});
```

```python Python theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
# Get URL with default permissions (git:write/git:read) and 1-year TTL
url = await repo.get_remote_url()
# Returns: https://t:JWT@your-name.code.storage/repo-id.git

# Configure the Git remote
print(f"Run: git remote add origin {url}")

# Get URL with custom permissions and TTL
read_only_url = await repo.get_remote_url(
    permissions=["git:read"],  # Read-only access
    ttl=3600,  # 1 hour in seconds
)

# Disable force push on every branch
safe_push_url = await repo.get_remote_url(
    ref_policies=[{"pattern": "refs/heads/*", "ops": ["no-force-push"]}],
)

# Get ephemeral remote URL (points to the ephemeral namespace)
ephemeral_url = await repo.get_ephemeral_remote_url()
# Returns: https://t:JWT@your-name.code.storage/repo-id+ephemeral.git

# Get ephemeral URL with custom permissions and TTL
custom_ephemeral_url = await repo.get_ephemeral_remote_url(
    permissions=["git:write", "git:read"],
    ttl=3600,
)

# Available permissions:
# - 'git:read'   - Read access to Git repository
# - 'git:write'  - Write access to Git repository
# - 'repo:write' - Create, update, and delete repositories, and manage their
#                  upstream credentials
```

```go Go theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
// Default: read/write access, 1-year TTL
url, err := repo.RemoteURL(context.Background(), storage.RemoteURLOptions{})
fmt.Printf("Run: git remote add origin %s", url)

// Read-only access with 1-hour TTL
readOnlyURL, err := repo.RemoteURL(context.Background(), storage.RemoteURLOptions{
	Permissions: []storage.Permission{storage.PermissionGitRead},
	TTL:         time.Hour,
})

// Disable force push on every branch
safePushURL, err := repo.RemoteURL(context.Background(), storage.RemoteURLOptions{
	RefPolicies: storage.RefPolicyList{
		{Pattern: "refs/heads/*", Ops: storage.Ops{storage.OpNoForcePush}},
	},
})

// Ephemeral namespace URL
ephemeralURL, err := repo.EphemeralRemoteURL(context.Background(), storage.RemoteURLOptions{})
```

## Options

**permissions** `string`

Array of permissions. Defaults to `["git:read", "git:write"]`.

**ttl** `string`

Token TTL. Token TTL in seconds. Defaults to 1 year.

**refPolicies** `object[]`

Ordered ref policy rules. Each entry is `{ pattern, ops? }`. Code Storage uses the first rule that matches the target ref.

An entry with no `ops` permits the matched ref. Code Storage treats a pattern without `refs/` as a
branch name.

Use `ref_policies` in Python. Use `RefPolicies` with `storage.RefPolicyList` in Go.

Available operations:

| Operation | Constant | Description |
| - | - | - |
| `no-force-push` | `OP_NO_FORCE_PUSH` (TypeScript/Python) / `OpNoForcePush` (Go) | Rejects a non-fast-forward move when the ref already exists. |
| `no-push` | `OP_NO_PUSH` (TypeScript/Python) / `OpNoPush` (Go) | Rejects any update to the matched ref. |
| `verify-sig` | `OP_VERIFY_SIG` (TypeScript/Python) / `OpVerifySig` (Go) | Rejects introduced commits without a trusted signature. |

See [Ref Policies](https://code.storage/docs/repos/ref-policies.md) for full details.

## Available Permissions

| Permission | Description |
| - | - |
| `git:read` | Read access to Git repository |
| `git:write` | Write access to Git repository |
| `repo:write` | Create, update, and delete repositories, detach upstreams, and manage stored Git credentials |

## Ephemeral Remote URL

Use `getEphemeralRemoteURL()` (TypeScript), `get_ephemeral_remote_url()` (Python), or
`EphemeralRemoteURL()` (Go) to generate URLs that point to the ephemeral namespace. Use this
namespace for isolated refs that must not sync to an upstream host.

See [Ephemeral Namespace](https://code.storage/docs/repos/ephemeral-branches.md) and
[`getEphemeralRemoteURL()` reference](https://code.storage/docs/sdk/repos/ephemeral-remote-url-get) for details.

## Import Remote URL

Use `getImportRemoteURL()` (TypeScript), `get_import_remote_url()` (Python), or `ImportRemoteURL()`
(Go) to generate URLs that point to the `+import` push namespace. Pushing to this URL triggers
immediate cold-storage archival after pack distribution.

See the [Import Namespace guide](https://code.storage/docs/repos/imports.md) and
[`getImportRemoteURL()` reference](https://code.storage/docs/sdk/repos/import-remote-url-get) for details.

## Response

Returns a `string` containing the HTTPS Git remote URL with embedded JWT authentication:

```
https://t:{jwt}@{org}.code.storage/{repo-id}.git
```

For ephemeral URLs:

```
https://t:{jwt}@{org}.code.storage/{repo-id}+ephemeral.git
```

For import URLs:

```
https://t:{jwt}@{org}.code.storage/{repo-id}+import.git
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.