Overview
Daytona’s Git integration enables:- Repository cloning - Clone public and private repositories
- Branch management - Create, checkout, and delete branches
- Commit operations - Stage, commit, push, and pull changes
- Status tracking - Monitor repository state and changes
Repository Cloning
Clone Public Repository
Clone a public repository with default branch:Clone Specific Branch
Clone a specific branch:Clone Private Repository
Clone with authentication credentials:Clone Specific Commit
Clone and checkout a specific commit (detached HEAD):string
required
Repository URL to clone from
string
required
Destination path in sandbox. Relative paths resolved from sandbox working directory.
string
Specific branch to clone. If not specified, clones the default branch.
string
Specific commit to checkout. Repository will be in detached HEAD state.
string
Git username for authentication
string
Git password or personal access token for authentication
Branch Management
List Branches
Get all branches in the repository:Create Branch
Create a new branch:Checkout Branch
Switch to an existing branch:Delete Branch
Delete a branch:string
required
Path to Git repository root. Relative paths resolved from sandbox working directory.
string
required
Branch name
Staging and Committing
Stage Files
Add files to the staging area:Commit Changes
Commit staged changes:Create Empty Commit
Create a commit without changes:string[]
required
List of file paths or directories to stage, relative to repository root
string
required
Commit message describing the changes
string
required
Name of the commit author
string
required
Email address of the commit author
boolean
Allow creating an empty commit when no changes are staged
Push and Pull
Push to Remote
Push local commits to remote repository:Pull from Remote
Pull changes from remote repository:string
Git username for authentication
string
Git password or token for authentication
Repository Status
Get Status
Check repository status:Complete Workflow Example
Authentication Best Practices
Use Personal Access Tokens
Use Personal Access Tokens
For GitHub and GitLab, use personal access tokens instead of passwords:
- GitHub: Generate at Settings → Developer settings → Personal access tokens
- GitLab: Generate at User Settings → Access Tokens
Store Credentials Securely
Store Credentials Securely
Never hardcode credentials. Use environment variables or secret management:
SSH Keys for Automated Workflows
SSH Keys for Automated Workflows
For automated workflows, consider using SSH keys instead of HTTPS with tokens.
Error Handling
Related Resources
File System
Manage files and directories in sandboxes
Language Server Protocol
Code intelligence for repository analysis