Git operations facade for a specific Sandbox.
Provides repository clone, branch, commit, status, and sync operations mapped to Daytona toolbox Git endpoints.
Methods
Section titled “Methods”clone()
Section titled “clone()”public void clone(String url, String path)Clones a Git repository into the specified path.
Parameters:
urlString - repository URLpathString - destination path in the Sandbox
Throws:
io.daytona.sdk.exception.DaytonaException- if cloning fails
clone()
Section titled “clone()”public void clone(String url, String path, String branch, String commitId, String username, String password)Clones a repository with optional branch, commit, and credentials.
Parameters:
urlString - repository URLpathString - destination path in the SandboxbranchString - branch to clone;nulluses default branchcommitIdString - commit SHA to checkout after clone;nullskips detached checkoutusernameString - username for authenticated remotespasswordString - password or token for authenticated remotes
Throws:
io.daytona.sdk.exception.DaytonaException- if cloning fails
clone()
Section titled “clone()”public void clone(String url, String path, String branch, String commitId, String username, String password, Boolean insecureSkipTls)Clones a repository with optional branch, commit, credentials, and TLS verification override.
Parameters:
urlString - repository URLpathString - destination path in the SandboxbranchString - branch to clone;nulluses default branchcommitIdString - commit SHA to checkout after clone;nullskips detached checkoutusernameString - username for authenticated remotespasswordString - password or token for authenticated remotesinsecureSkipTlsBoolean - whentrue, skip TLS certificate verification (insecure). Use only for trusted internal Git servers with self-signed or private-CA certs; credentials, if supplied, are transmitted over an unverified TLS connection.nullorfalsekeeps strict TLS verification.
Throws:
io.daytona.sdk.exception.DaytonaException- if cloning fails
clone()
Section titled “clone()”public void clone(String url, String path, String branch, String commitId, String username, String password, Boolean insecureSkipTls, Integer depth)Clones a repository with optional branch, commit, credentials, TLS verification override, and shallow depth.
Parameters:
urlString - repository URLpathString - destination path in the SandboxbranchString - branch to clone;nulluses default branchcommitIdString - commit SHA to checkout after clone;nullskips detached checkoutusernameString - username for authenticated remotespasswordString - password or token for authenticated remotesinsecureSkipTlsBoolean - whentrue, skip TLS certificate verification (insecure)depthInteger - create a shallow clone truncated to the given number of commits;nullclones full history
Throws:
io.daytona.sdk.exception.DaytonaException- if cloning fails
branches()
Section titled “branches()”public Map<String, Object> branches(String path)Lists branches in a repository.
Parameters:
pathString - repository path in the Sandbox
Returns:
Map\<String, Object\>- map containingbrancheslist
Throws:
io.daytona.sdk.exception.DaytonaException- if the operation fails
public void add(String path, List<String> files)Stages files for commit.
Parameters:
pathString - repository path in the SandboxfilesList<String> - file paths to stage relative to repository root
Throws:
io.daytona.sdk.exception.DaytonaException- if staging fails
commit()
Section titled “commit()”public GitCommitResponse commit(String path, String message, String author, String email)Creates a commit from staged changes.
Parameters:
pathString - repository path in the SandboxmessageString - commit messageauthorString - author display nameemailString - author email address
Returns:
GitCommitResponse- commit metadata containing resulting hash
Throws:
io.daytona.sdk.exception.DaytonaException- if commit fails
status()
Section titled “status()”public GitStatus status(String path)Retrieves Git status for a repository.
Parameters:
pathString - repository path in the Sandbox
Returns:
GitStatus- repository status including branch divergence and file status entries
Throws:
io.daytona.sdk.exception.DaytonaException- if the operation fails
push()
Section titled “push()”public void push(String path)Pushes local commits to remote.
Parameters:
pathString - repository path in the Sandbox
Throws:
io.daytona.sdk.exception.DaytonaException- if push fails
push()
Section titled “push()”public void push(String path, String username, String password, String branch, String remote, Boolean setUpstream)Pushes local commits to remote with optional credentials, branch, remote, and upstream tracking.
Parameters:
pathString - repository path in the SandboxusernameString - username for authenticated remotespasswordString - password or token for authenticated remotesbranchString - branch to push;nulluses the current branchremoteString - remote to push to;nulluses “origin”setUpstreamBoolean - whentrue, record the pushed branch as the upstream tracking branch
Throws:
io.daytona.sdk.exception.DaytonaException- if push fails
pull()
Section titled “pull()”public void pull(String path)Pulls updates from remote.
Parameters:
pathString - repository path in the Sandbox
Throws:
io.daytona.sdk.exception.DaytonaException- if pull fails
pull()
Section titled “pull()”public void pull(String path, String username, String password, String branch, String remote)Pulls updates from remote with optional credentials, branch, and remote.
Parameters:
pathString - repository path in the SandboxusernameString - username for authenticated remotespasswordString - password or token for authenticated remotesbranchString - branch to pull;nulluses the current branch’s upstreamremoteString - remote to pull from;nulluses “origin”
Throws:
io.daytona.sdk.exception.DaytonaException- if pull fails
createBranch()
Section titled “createBranch()”public void createBranch(String path, String name)Creates a new branch at the current HEAD.
Parameters:
pathString - repository path in the SandboxnameString - name of the new branch
Throws:
io.daytona.sdk.exception.DaytonaException- if branch creation fails
checkoutBranch()
Section titled “checkoutBranch()”public void checkoutBranch(String path, String branch)Checks out a branch or commit.
Parameters:
pathString - repository path in the SandboxbranchString - branch name or commit SHA to checkout
Throws:
io.daytona.sdk.exception.DaytonaException- if checkout fails
deleteBranch()
Section titled “deleteBranch()”public void deleteBranch(String path, String name)Deletes a branch.
Parameters:
pathString - repository path in the SandboxnameString - name of the branch to delete
Throws:
io.daytona.sdk.exception.DaytonaException- if deletion fails
init()
Section titled “init()”public void init(String path)Initializes a new Git repository at the specified path.
Parameters:
pathString - destination path in the Sandbox
Throws:
io.daytona.sdk.exception.DaytonaException- if initialization fails
init()
Section titled “init()”public void init(String path, Boolean bare, String initialBranch)Initializes a new Git repository with optional bare mode and initial branch.
Parameters:
pathString - destination path in the SandboxbareBoolean - whentrue, create a bare repository without a working treeinitialBranchString - name of the initial branch;nulluses the Git default
Throws:
io.daytona.sdk.exception.DaytonaException- if initialization fails
reset()
Section titled “reset()”public void reset(String path)Resets the current HEAD to HEAD (mixed reset, unstaging changes).
Parameters:
pathString - repository path in the Sandbox
Throws:
io.daytona.sdk.exception.DaytonaException- if reset fails
reset()
Section titled “reset()”public void reset(String path, String mode, String target, List<String> files)Resets the current HEAD to the specified state.
Parameters:
pathString - repository path in the SandboxmodeString - reset mode: “soft”, “mixed” (default), “hard”, “merge” or “keep”;nulluses “mixed”targetString - revision to reset to;nulluses HEADfilesList<String> - constrain the reset to the given paths;nullresets all
Throws:
io.daytona.sdk.exception.DaytonaException- if reset fails
restore()
Section titled “restore()”public void restore(String path, List<String> files)Restores working tree files for the given paths (discarding local changes).
Parameters:
pathString - repository path in the SandboxfilesList<String> - file paths to restore
Throws:
io.daytona.sdk.exception.DaytonaException- if restore fails
restore()
Section titled “restore()”public void restore(String path, List<String> files, Boolean staged, Boolean worktree, String source)Restores working tree files or unstages changes.
Parameters:
pathString - repository path in the SandboxfilesList<String> - file paths to restorestagedBoolean - restore the staging index for the given filesworktreeBoolean - restore the working tree for the given files; defaults totruewhen both arenullsourceString - restore file contents from the given revision instead of the index
Throws:
io.daytona.sdk.exception.DaytonaException- if restore fails
remoteAdd()
Section titled “remoteAdd()”public void remoteAdd(String path, String name, String url)Adds a remote to the repository.
Parameters:
pathString - repository path in the SandboxnameString - name of the remoteurlString - URL of the remote
Throws:
io.daytona.sdk.exception.DaytonaException- if adding the remote fails
remoteAdd()
Section titled “remoteAdd()”public void remoteAdd(String path, String name, String url, Boolean fetch, Boolean overwrite)Adds (or overwrites) a remote in the repository.
Parameters:
pathString - repository path in the SandboxnameString - name of the remoteurlString - URL of the remotefetchBoolean - whentrue, fetch from the remote immediately after adding itoverwriteBoolean - whentrue, replace an existing remote with the same name
Throws:
io.daytona.sdk.exception.DaytonaException- if adding the remote fails
remotes()
Section titled “remotes()”public List<GitRemote> remotes(String path)Lists the remotes configured in the repository.
Parameters:
pathString - repository path in the Sandbox
Returns:
List\<GitRemote\>- the configured remotes (name + URL)
Throws:
io.daytona.sdk.exception.DaytonaException- if listing remotes fails
remoteGet()
Section titled “remoteGet()”public String remoteGet(String path, String name)Gets the URL of a remote, or null when it does not exist.
Parameters:
pathString - repository path in the SandboxnameString - name of the remote
Returns:
String- the remote URL, ornullwhen the remote does not exist
Throws:
io.daytona.sdk.exception.DaytonaException- if the operation fails
setConfig()
Section titled “setConfig()”public void setConfig(String key, String value)Sets a Git config value at the global scope.
Parameters:
keyString - config key in dotted form (e.g. “user.name”)valueString - config value
Throws:
io.daytona.sdk.exception.DaytonaException- if setting config fails
setConfig()
Section titled “setConfig()”public void setConfig(String key, String value, String scope, String path)Sets a Git config value at the given scope.
Parameters:
keyString - config key in dotted form (e.g. “user.name”)valueString - config valuescopeString - config scope: “global” (default), “local” or “system”pathString - repository path, required when scope is “local”
Throws:
io.daytona.sdk.exception.DaytonaException- if setting config fails
getConfig()
Section titled “getConfig()”public String getConfig(String key)Gets a Git config value at the global scope, or null when unset.
Parameters:
keyString - config key in dotted form (e.g. “user.name”)
Returns:
String- the config value, ornullwhen the key is not set
Throws:
io.daytona.sdk.exception.DaytonaException- if getting config fails
getConfig()
Section titled “getConfig()”public String getConfig(String key, String scope, String path)Gets a Git config value at the given scope, or null when unset.
Parameters:
keyString - config key in dotted form (e.g. “user.name”)scopeString - config scope: “global” (default), “local” or “system”pathString - repository path, required when scope is “local”
Returns:
String- the config value, ornullwhen the key is not set
Throws:
io.daytona.sdk.exception.DaytonaException- if getting config fails
configureUser()
Section titled “configureUser()”public void configureUser(String name, String email)Configures the Git user name and email at the global scope.
Parameters:
nameString - user name (user.name)emailString - user email (user.email)
Throws:
io.daytona.sdk.exception.DaytonaException- if configuring user fails
configureUser()
Section titled “configureUser()”public void configureUser(String name, String email, String scope, String path)Configures the Git user name and email at the given scope.
Parameters:
nameString - user name (user.name)emailString - user email (user.email)scopeString - config scope: “global” (default), “local” or “system”pathString - repository path, required when scope is “local”
Throws:
io.daytona.sdk.exception.DaytonaException- if configuring user fails
dangerouslyAuthenticate()
Section titled “dangerouslyAuthenticate()”public void dangerouslyAuthenticate(String username, String password)Persists Git credentials globally so that subsequent operations against github.com authenticate automatically.
This stores the password in plaintext on disk via the Git credential store.
Parameters:
usernameString - Git usernamepasswordString - Git password or token
Throws:
io.daytona.sdk.exception.DaytonaException- if authentication fails
dangerouslyAuthenticate()
Section titled “dangerouslyAuthenticate()”public void dangerouslyAuthenticate(String username, String password, String host, String protocol)Persists Git credentials globally so that subsequent operations against the given host authenticate automatically.
This stores the password in plaintext on disk via the Git credential store.
Parameters:
usernameString - Git usernamepasswordString - Git password or tokenhostString - host to authenticate against;nulluses “github.com”protocolString - protocol to authenticate against;nulluses “https”
Throws:
io.daytona.sdk.exception.DaytonaException- if authentication fails