Work with Git
Sandboxes are useful for inspecting code and runtime state in the same environment that Polyaxon uses to run workloads. For reproducible work, prefer starting from a known Git commit and pushing durable changes back to a remote repository.
This page continues from the Sandbox Quick Start and uses its quick-start project, /workspace directory, and RUN_UUID variable.
Clone Code at Startup
Use your normal Polyaxonfile initialization and connection patterns to clone code before the service starts. For Git over SSH, configure an SSH connection and reference it from your component or preset.
To clone into the scratch workspace after the service starts:
polyaxon sandbox exec -p quick-start -uid $RUN_UUID -- \
git clone REPOSITORY_URL /workspace/repoInspect the Repository
polyaxon sandbox exec -p quick-start -uid $RUN_UUID -- git -C /workspace/repo status
polyaxon sandbox exec -p quick-start -uid $RUN_UUID -- git -C /workspace/repo diffOpen a shell when you need an interactive Git workflow:
polyaxon sandbox shell -p quick-start -uid $RUN_UUIDUpload Local Changes
For small files or patches:
polyaxon sandbox upload -p quick-start -uid $RUN_UUID ./train.py /workspace/repo/train.pyFor larger repository workflows, use SSH with your local Git tooling or clone directly from inside the sandbox.
Push Changes
Push changes only when the sandbox has an appropriate Git credential. In most teams, that means mounting a scoped SSH connection or using a service account with limited repository permissions.
polyaxon sandbox exec -p quick-start -uid $RUN_UUID -- git -C /workspace/repo status
polyaxon sandbox exec -p quick-start -uid $RUN_UUID -- git -C /workspace/repo push origin HEADKeep credentials in Polyaxon connections rather than baking them into images or notebooks.