Skip to content
garage
Esc
navigateopen⌘Jpreview

Create an anonymous repository

Create a time-limited repository without signing in.

Choose the CLI when you need a Git remote. Choose the SDK when you want to commit files from JavaScript.

Create a repository with a six-hour lifetime:

garage anon create --ttl 6h

Use the returned name to clone and push:

garage anon clone <name>
cd <name>
printf '# Temporary repository\n' > README.md
git add README.md
git commit -m "Initial commit"
git push -u origin main

Confirm its expiration time:

garage anon list <name>

Install the SDK:

npm install @thegarage/sdk

Create and write the repository:

import { garage } from '@thegarage/sdk'

const repo = await garage.ephemeral({ ttl: '6h' })

await repo.add('README.md', '# Temporary repository\n')
const commit = await repo.commit('Initial commit')

console.log(commit.sha)
console.log(repo.remote)
console.log(repo.expiresAt)

The default lifetime is 24 hours. The accepted range is 60 seconds through 72 hours. Read Anonymous repository lifecycle before you store data that must remain available.

Was this page helpful?