Skip to content

Origins & Destinations Overview

Copybara’s architecture is based on origins (where code comes from) and destinations (where code goes to).

Diagram
OriginDescriptionUse Case
git.originGeneric Git repositoryAny Git repo
git.github_originGitHub with API integrationGitHub repos
git.github_pr_originGitHub pull requestsImporting PRs
git.gerrit_originGerrit with CL integrationGerrit repos
git.github_triggerGitHub eventsFeedback workflows
folder.originLocal filesystemTesting, local ops
DestinationBehaviorUse Case
git.destinationPush to branchDirect sync
git.github_destinationPush to GitHubGitHub repos
git.github_pr_destinationCreate GitHub PRsPR-based sync
git.gerrit_destinationCreate Gerrit CLsGerrit repos
git.github_apiGitHub API actionsFeedback workflows
folder.destinationLocal filesystemTesting, preview
# Generic Git
origin = git.origin(
url = "https://github.com/org/repo",
ref = "main",
)
# GitHub with extra features
origin = git.github_origin(
url = "https://github.com/org/repo",
ref = "main",
)
origin = git.github_pr_origin(
url = "https://github.com/org/repo",
branch = "main",
)
origin = folder.origin()
destination = git.destination(
url = "https://github.com/org/repo",
push = "main",
)
destination = git.github_pr_destination(
url = "https://github.com/org/repo",
destination_ref = "main",
)
destination = git.gerrit_destination(
url = "https://gerrit.example.com/repo",
push_to_refs_for = "main",
)
destination = folder.destination()
origin = git.origin(url = internal_url, ref = "main")
destination = git.github_destination(url = github_url, push = "main")
origin = git.github_pr_origin(url = github_url, branch = "main")
destination = git.gerrit_destination(url = internal_url, ...)
origin = git.origin(url = internal_url, ref = "main")
destination = git.github_pr_destination(url = github_url, destination_ref = "main")
origin = folder.origin()
destination = folder.destination()

See Authentication guide for details on:

  • Personal Access Tokens
  • SSH keys
  • Deploy keys
  • Fine-grained tokens