Relace Repos is designed to be the source control for your coding agent. You will likely need to integrate with GitHub if you want to support collaboration with human developers. There are two ways to set up a GitHub integration with Relace depending on whether you want to link to personal GitHub repos or to user repos via your GitHub app. You can provision access to repos belonging to you or your organization with the Relace GitHub App. Go to GitHub settings on the Relace dashboard and choose the “Use Your Own Repos” option. Use Your Own Repos option In the GitHub app installation flow, you can either allow full access or select specific repos to give Relace. To give Relace access to your users’ GitHub repos, you need to maintain your own GitHub app. You can find documentation on creating GitHub Apps in the GitHub documentation. Once you’ve registered and created your app, go to GitHub settings on the Relace dashboard and choose the “Use Your GitHub App” option. Use Your GitHub App option We’ll use the credentials you provide to pull relevant repos from users on your behalf.

Sync to Relace from GitHub

You can now initialize a Relace Repo by providing a url to a GitHub repo that Relace has been authorized to use.
url = "https://api.relace.run/v1/repo"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

data = {
    "source": {
        "type": "git",
        "url": "https://github.com/username/repository-name",
        "branch": "main"
    },
    "metadata": {}  # Optional: add any custom properties
}

response = requests.post(url, headers=headers, json=data)
repo = response.json()
print(f"Repository created with ID: {repo['repo_id']}")
If the Relace Repo has not diverged from the GitHub source, you can sync the two in a similar way.
url = f"https://api.relace.run/v1/repo/{repo_id}/update"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

data = {
    "source": {
        "type": "git",
        "url": "https://github.com/username/repository-name",
        "branch": "main"
    }
}

response = requests.post(url, headers=headers, json=data)
repo = response.json()
print(f"Repository updated: {repo['repo_id']}")
Reverse synchronization (pushing changes from Relace Repos back to GitHub) is not currently supported but will be available in an upcoming release.
For more details on the GitHub related operations, see the API reference.