pradana adnyana
02/19/2026, 2:00 AMMarvin
02/19/2026, 2:00 AMMarvin
02/19/2026, 2:03 AMflow.from_source(..., credentials=...)?
- If behind a proxy, does the container have HTTPS_PROXY/NO_PROXY set correctly?
- Any submodules? If yes and they’re private, set include_submodules=True and provide credentials.
How Prefect 3.x clones from Git and how to pass credentials
Prefect 3.x uses flow.from_source(...) under the hood which constructs a GitRepository and runs git clone in a subprocess. If cloning fails, Prefect wraps the git error and hides any embedded credentials, which is why you just see “exit code 255”.
- Source code for the git clone step:
- https://github.com/PrefectHQ/prefect/blob/main/src/prefect/runner/storage.py
- Prefect GitHub integration (credential block):
- https://github.com/PrefectHQ/prefect-github
- Prefect GitLab integration (credential block):
- https://github.com/PrefectHQ/prefect-gitlab
Examples to fix it
1) Quick test (not for production) — embed a token in the URL
- GitHub:
source = "https://<YOUR_GH_TOKEN>@github.com/aidevakasha/outlet.git"
Then redeploy with that source. If this works, your original issue is authentication.
2) Recommended — pass credentials explicitly
- Using a provider block (GitHub):
from prefect import flow
from prefect_github import GitHubCredentials
creds = GitHubCredentials(token="<your-gh-pat>") # or GitHubCredentials.load("my-gh-creds-block")
f = flow.from_source(
source="<https://github.com/aidevakasha/outlet.git>",
entrypoint="path/to/your_flow.py:my_flow",
credentials=creds,
# include_submodules=True, # if you use private submodules
)
f.deploy(
name="my-deployment",
work_pool_name="my-pool"
)
- Using a simple dict (works for GitHub PATs):
f = flow.from_source(
source="<https://github.com/aidevakasha/outlet.git>",
entrypoint="path/to/your_flow.py:my_flow",
credentials={"access_token": "<your-gh-pat>"}
)
Notes and gotchas
- GitHub PAT must have at least “Contents: Read” for the repo (and must be SSO-authorized if your org enforces SSO).
- If you use private submodules, set `include_submodules=True`; Prefect will propagate credentials to submodules on the same host.
- If you’re pinning a specific commit, use commit_sha (don’t combine with branch).
- For corporate proxies, ensure the worker/container can curl <https://github.com> and git clone directly; set `HTTPS_PROXY`/`NO_PROXY` if needed.
How to get the full git error message
Because Prefect hides credentials in errors, run the same clone inside the worker image to see the exact git message:
- If you use a Docker work pool: exec into a running worker or start a shell with the same image, then run
git clone <https://github.com/aidevakasha/outlet.git>
or with a token:
git clone https://<YOUR_GH_TOKEN>@github.com/aidevakasha/outlet.git
If you can share:
- Is the repo private?
- How are you creating the deployment (code or CLI) and what does that snippet look like?
- What work pool/worker type and image are you using?
- Any proxies or submodules involved?
I can tailor the exact fix once I know those details.pradana adnyana
02/19/2026, 2:26 AMMarvin
02/19/2026, 2:26 AMMarvin
02/19/2026, 2:30 AM<https://...>. Use:
github_url = "<https://github.com/aidevakasha/outlet.git>"
Other things to double‑check that commonly cause git clone failures with Prefect 3.x:
- Ensure the GitHub integration is installed everywhere this runs (both where you deploy and on the worker):
pip install "prefect-github"
- Make sure you’re importing the right class:
from prefect.runner.storage import GitRepository
from prefect_github import GitHubCredentials
- Verify the token in your GitHubCredentials block “github-creds” has repo read access to aidevakasha/outlet and the branch “staging” exists.
- Don’t log your token:
# Remove this — it prints your secret
logger.debug(f"Loaded GitHub credentials: {github_credentials_block.token.get_secret_value()}")
- Workers need git installed and outbound network access to github.com. If you’re using Docker/K8s workers, confirm the image has git and can reach GitHub.
- If your repo uses private submodules, set include_submodules=True on GitRepository.
Also, in Prefect 3.x flow.from_source(...) and .deploy(...) are synchronous. You don’t need await or an asyncio wrapper for deployment. A minimal corrected version:
from prefect import flow
from prefect.runner.storage import GitRepository
from prefect_github import GitHubCredentials
def deploy_all():
github_repo = GitRepository(
url="<https://github.com/aidevakasha/outlet.git>",
credentials=GitHubCredentials.load("github-creds"),
branch="staging",
# include_submodules=True, # if you use private submodules
)
gmaps_flow = flow.from_source(
source=github_repo,
entrypoint="workflows/flows/google_maps_outlet_scrape_flow.py:scrape_google_maps_flow",
)
gmaps_flow.deploy(
name="google-maps-outlet-scrape-flow-deployment",
work_pool_name="default-pool",
ignore_warnings=True,
version="19.02.2025",
tags=["v19.02.2025"],
)
orchestrator_flow = flow.from_source(
source=github_repo,
entrypoint="workflows/deployments/google_maps_scrape.py:run_flow_with_params",
)
orchestrator_flow.deploy(
name="orchestrator-deployment",
work_pool_name="default-pool",
ignore_warnings=True,
version="19.02.2025",
tags=["v19.02.2025"],
)
if __name__ == "__main__":
deploy_all()
If this still fails, could you paste:
- The exact git error message (exit code 128 text, “Permission denied (publickey)”, “Repository not found”, etc.)
- Whether the failure occurs during deployment or when the worker starts the flow
- Where the worker is running (local/Docker/Kubernetes) and whether git --version works there
With that, I can pinpoint the cause quickly.