Repository Upstream Field
Date:October 06, 2026Author:Nicolas GallagherCategory:ENGINEERINGThe create-repository request now has one field for each kind of source. base_repo is a one-time
copy of a Code Storage repository; upstream is a lasting link to an external Git host. Set at most
one of the two. A request with both returns 400.
base_repo takes name, ref, and auth.token. The token needs git:read on the source
repository. ref accepts a branch, a tag, or a commit SHA. It defaults to the HEAD of the source.
curl "$PIERRE_API_BASE_URL/repos" \
-X POST \
-H "Authorization: Bearer $PIERRE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"repo_name": "my-project",
"base_repo": {
"name": "template-repo",
"ref": "main",
"auth": { "token": "'"$SOURCE_TOKEN"'" }
}
}'{
"repo_name": "my-project",
"message": "Repository 'NSIZAW55paRNvTbRYvvu4' created successfully"
}The new repository has one branch at the source commit, with the history of that commit. It keeps no link to the source.
upstream takes provider, owner, and name. Set host for a self-hosted provider. For a
public GitHub repository, set access to public. Code Storage then needs no GitHub App, and it
syncs only when you ask:
curl "$PIERRE_API_BASE_URL/repos" \
-X POST \
-H "Authorization: Bearer $PIERRE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"repo_name": "hello-world",
"upstream": {
"provider": "github",
"owner": "octocat",
"name": "Hello-World",
"access": "public"
}
}'{
"repo_name": "hello-world",
"message": "Repository 'rX8TDSb7Oq7JLbl5stQBt' created successfully"
}A read of the repository returns its upstream:
curl "$PIERRE_API_BASE_URL/repos/hello-world" \
-H "Authorization: Bearer $PIERRE_TOKEN"{
"repo_name": "hello-world",
"default_branch": "master",
"created_at": "2026-10-06T20:34:45Z",
"upstream": {
"provider": "github",
"owner": "octocat",
"name": "Hello-World"
}
}The response also has base_repo, with the same value as upstream. It is deprecated. Read
upstream instead.
The old form of base_repo, with provider and operation, still works. It is deprecated. Move a
sync to upstream, and keep name in upstream.name. Move each other field to its replacement:
| Deprecated field | Replacement |
|---|---|
base_repo.provider | upstream.provider. A copy has no provider. |
base_repo.owner | upstream.owner |
base_repo.operation | upstream for a sync, and base_repo for a copy |
base_repo.sha | base_repo.ref, which accepts a commit SHA |
base_repo.upstream_host | upstream.host |
base_repo.auth.auth_type | upstream.access for a public GitHub sync. A copy has none |
base_repo.default_branch | the top-level default_branch |
response base_repo | response upstream |
See the API reference for repos.create, and the
guides for forks,
GitHub Sync, and
Generic Sync.