Ed Hartley
10/16/2025, 3:53 PMMarvin
10/16/2025, 3:53 PMMarvin
10/16/2025, 3:56 PMgit_clone pull step creates a checkout directory at runtime (inside the worker’s process), and returns its path as the step’s output under the key directory. That path is not persisted in prefect.yaml and there’s no built-in env var for it.
How to use/see it:
- Give your git_clone step an id, then reference the path with templating like {{ <step-id>.directory }} in later steps (e.g., to set the working directory or to log it).
- Example:
pull:
- prefect.deployments.steps.pull.git_clone:
id: get-code
repository: <https://github.com/owner/repo.git>
branch: main
- prefect.deployments.steps.utility.run_shell_script:
script: |
echo "Repo cloned to: {{ get-code.directory }}"
- prefect.deployments.steps.pull.set_working_directory:
directory: "{{ get-code.directory }}"
If you want to verify the path from your flow code, you can also log Path.cwd() at the start of your flow (after the pull steps run, your working directory will typically be the cloned repo if you set it as above).
Docs:
- Pull steps, including `git_clone`: prefect.deployments.steps.pull
- Prefect YAML reference: prefect.yaml guide
If you’re on Prefect 2.x, it’s similar: the temp directory isn’t stored in the YAML; you reference the step output. If you need something different, like cloning into a specific fixed path, let me know your constraints and I can suggest an approach.