Skip to main content
The SDK exposes sandbox.git helpers for common repository workflows: cloning, branching, committing, pulling, pushing, managing remotes, and configuring Git. Credentials can be passed inline to each operation, or stored once in the sandbox credential helper.
Install the SDK, or the CLI for ppio commands, and set the PPIO_API_KEY and PPIO_DOMAIN environment variables before running these examples. See Quickstart and Install and authenticate.
Credentials stored with dangerouslyAuthenticate() or dangerously_authenticate() are written to disk inside the sandbox and can be read by anything with sandbox access. Credentials kept in a remote URL with dangerouslyStoreCredentials or dangerously_store_credentials remain in the repository config and are readable by sandbox processes.

Authenticate, clone, commit and push

1

Authenticate to the Git server

Store the credentials in the sandbox credential helper. This example targets a custom HTTPS server; without host, the credentials are stored for GitHub.
2

Clone the repository

3

Stage and commit a change

4

Push to the upstream branch

5

Clean up

Full example

Inline credentials

For private HTTPS repositories, pass a username and password or token directly to operations such as push, pull, or clone.

Store credentials with the credential helper

dangerouslyAuthenticate() or dangerously_authenticate() stores credentials inside the sandbox credential helper. Credentials are stored for GitHub by default, or for a custom HTTPS server when host is set.
Credentials are written to disk inside the sandbox and can be read by anything with sandbox access.

Keep credentials in the remote URL

By default, credentials are removed from the remote URL after clone. To retain them in .git/config, set dangerouslyStoreCredentials: true in Node.js or dangerously_store_credentials=True in Python.
Credentials kept in a remote URL remain in the repository config and are readable by sandbox processes.

Configure commit identity

configureUser() or configure_user() sets the commit author details globally, or locally for one repository.

Clone a repository

Clone options include the destination path, branch selection, depth, username, password, and credential storage behavior.
Destination path.
Branch to check out.
Clone depth.
Username for HTTPS authentication.
Password or personal access token.
Keep credentials in the remote URL.

Inspect and manage branches

status() reports the current branch, the ahead and behind counts, and the status of each file. branches() returns the branch list and the current branch.

Stage and commit changes

add stages all changes or selected files. commit creates a commit, with options for the author name, author email, and empty commits.
Files to stage. Omit it to stage all changes.
Author name for the commit.
Author email for the commit.
Create a commit with no staged changes.

Pull and push

push and pull use the configured upstream by default. A remote, a branch, and upstream configuration can also be set per call.
Remote to push to or pull from.
Branch to push to or pull from.
Set the pushed branch as the upstream.

Manage remotes and configuration

remoteAdd() or remote_add() adds a remote, optionally fetches after adding, or overwrites an existing remote. setConfig() and getConfig(), or set_config() and get_config(), manage Git settings globally or per repository. remote_add() / remoteAdd() options:
Fetch after adding the remote.
Overwrite an existing remote with the same name.
set_config() / get_config() options:
Apply the setting globally or to one repository.
Repository path for a local setting.
Last modified on November 19, 2026