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.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 aspush, 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.
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.
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.- Python
- Node.js
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.
- Python
- Node.js
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.
- Python
- Node.js
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:
set_config() / get_config() options: