> ## 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.getEphemeralRemoteURL()

> Generate authenticated Git URLs that point to the +ephemeral namespace.

> [!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).

Returns a JWT-authenticated remote URL for the `+ephemeral` namespace. Refs that you push through
this URL do not mirror to an upstream host. They remain separate from refs in the default namespace.

```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
// Default: read/write access, 1-year TTL
const ephemeralUrl = await repo.getEphemeralRemoteURL();
// Returns: https://t:JWT@your-name.code.storage/repo-id+ephemeral.git

// Short-lived URL for a single agent run
const sandboxUrl = await repo.getEphemeralRemoteURL({
  permissions: ['git:read', 'git:write'],
  ttl: 3600,
});

// Disable force push on every ephemeral ref
const safeEphemeralUrl = await repo.getEphemeralRemoteURL({
  refPolicies: [{ pattern: 'refs/namespaces/ephemeral/*', ops: ['no-force-push'] }],
});
```

```python Python theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
# Default: read/write access, 1-year TTL
ephemeral_url = await repo.get_ephemeral_remote_url()
# Returns: https://t:JWT@your-name.code.storage/repo-id+ephemeral.git

# Short-lived URL for a single agent run
sandbox_url = await repo.get_ephemeral_remote_url(
    permissions=['git:read', 'git:write'],
    ttl=3600,
)

# Disable force push on every ephemeral ref
safe_ephemeral_url = await repo.get_ephemeral_remote_url(
    ref_policies=[{"pattern": "refs/namespaces/ephemeral/*", "ops": ["no-force-push"]}],
)
```

```go Go theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
// Default: read/write access, 1-year TTL
ephemeralURL, err := repo.EphemeralRemoteURL(context.Background(), storage.RemoteURLOptions{})
fmt.Println(ephemeralURL)
// Prints: https://t:JWT@your-name.code.storage/repo-id+ephemeral.git

// Short-lived URL for a single agent run
sandboxURL, err := repo.EphemeralRemoteURL(context.Background(), storage.RemoteURLOptions{
	Permissions: []storage.Permission{
		storage.PermissionGitRead,
		storage.PermissionGitWrite,
	},
	TTL: time.Hour,
})

// Disable force push on every ephemeral ref
safeEphemeralURL, err := repo.EphemeralRemoteURL(context.Background(), storage.RemoteURLOptions{
	RefPolicies: storage.RefPolicyList{
		{Pattern: "refs/namespaces/ephemeral/*", Ops: storage.Ops{storage.OpNoForcePush}},
	},
})
```

## Options

**permissions** `string[]`

Array of permissions. Defaults to `["git:read", "git:write"]`. Accepts `git:read`, `git:write`,
`repo:write`, and `org:read`. See [Authentication](https://code.storage/docs/platform/authentication.md) for what each scope
grants.

**ttl** `number`

Token TTL in seconds. Defaults to 1 year.

**refPolicies** `object[]`

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

Code Storage stores an ephemeral branch under `refs/namespaces/ephemeral/refs/heads/`. A plain
`refs/heads/*` pattern does not match it.

Use a complete namespaced pattern or `*`. Use `ref_policies` in Python. Use `RefPolicies` with
`storage.RefPolicyList` in Go.

See [`getRemoteURL()`](https://code.storage/docs/sdk/repos/remote-url-get) for operations. See
[Ref Policies](https://code.storage/docs/repos/ref-policies.md#apply-policies-to-ephemeral-branches) for patterns.

**ops** `string[]` *deprecated*

Repo-wide policy ops. The gateway folds them into a catch-all `*` rule on verify. Use
`refPolicies` instead. See [Ref Policies](https://code.storage/docs/repos/ref-policies.md).

## Response

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

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

## Usage

Use the URL as a standard Git remote. Push and fetch work with ordinary Git commands:

```bash theme={"theme":{"light":"github-light","dark":"min-dark"}}
git remote add ephemeral <url>
git push ephemeral feature-branch
git fetch ephemeral feature-branch
```

> [!NOTE]
>
> The remote advertises ephemeral refs only. It does not show refs from the default namespace. The
> normal repository remote does not show ephemeral refs.

See [Ephemeral Namespace](https://code.storage/docs/repos/ephemeral-branches.md) for promotion workflows and the
[External Sandbox Integration guide](https://code.storage/docs/repos/external-sandboxes.md) for agent isolation patterns.


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