Failed to clone repository '<https://github.com/ai...
# ask-marvin
p
Failed to clone repository 'https://github.com/aidevakasha/outlet.git' with exit code 255. 085951 AM prefect.flow_runs Runner failed to retrieve flow to execute on_crashed hooks for flow run UUID('822d1dd9-da44-47b8-95c0-4945870ce32d'). Traceback (most recent call last): File "/app/.venv/lib/python3.13/site-packages/prefect/deployments/steps/core.py", line 186, in run_steps step_output = await run_step(step, upstream_outputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/prefect/deployments/steps/core.py", line 140, in run_step result = await from_async.call_soon_in_new_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Call.new(step_func, **inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ).aresult() ^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/prefect/_internal/concurrency/calls.py", line 374, in aresult return await asyncio.wrap_future(self.future) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/prefect/_internal/concurrency/calls.py", line 399, in _run_sync result = self.fn(*self.args, **self.kwargs) File "/app/.venv/lib/python3.13/site-packages/prefect/_internal/compatibility/async_dispatch.py", line 94, in wrapper return fn(*args, **kwargs) File "/app/.venv/lib/python3.13/site-packages/prefect/deployments/steps/pull.py", line 221, in git_clone run_coro_as_sync(_pull_git_repository_with_retries(storage)) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/prefect/utilities/asyncutils.py", line 207, in run_coro_as_sync return call.result() ~~~~~~~~~~~^^ File "/app/.venv/lib/python3.13/site-packages/prefect/_internal/concurrency/calls.py", line 365, in result return self.future.result(timeout=timeout) ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/prefect/_internal/concurrency/calls.py", line 192, in result return self.__get_result() ~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/app/.venv/lib/python3.13/site-packages/prefect/_internal/concurrency/calls.py", line 441, in _run_async result = await coro ^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/prefect/utilities/asyncutils.py", line 188, in coroutine_wrapper return await task ^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/prefect/_internal/retries.py", line 57, in wrapper return await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/prefect/deployments/steps/pull.py", line 47, in _pull_git_repository_with_retries await repo.pull_code() File "/app/.venv/lib/python3.13/site-packages/prefect/runner/storage.py", line 417, in pull_code await self._clone_repo() File "/app/.venv/lib/python3.13/site-packages/prefect/runner/storage.py", line 462, in _clone_repo raise RuntimeError( ...<2 lines>... ) from exc_chain RuntimeError: Failed to clone repository 'https://github.com/aidevakasha/outlet.git' with exit code 255. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/app/.venv/lib/python3.13/site-packages/prefect/runner/runner.py", line 1529, in _run_on_crashed_hooks flow = await load_flow_from_flow_run( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ flow_run, storage_base_path=str(self._tmp_dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/app/.venv/lib/python3.13/site-packages/prefect/client/utilities.py", line 69, in wrapper return await func(client, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/prefect/flows.py", line 2939, in load_flow_from_flow_run output = await run_steps( ^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "/app/.venv/lib/python3.13/site-packages/prefect/deployments/steps/core.py", line 231, in run_steps raise StepExecutionError(f"Encountered error while running {fqn}") from exc prefect.deployments.steps.core.StepExecutionError: Encountered error while running prefect.deployments.steps.git_clone @Marvin, why i got this error?
m
thought for 175.5 seconds
Short answer: your runner couldn’t git clone the repo, so it couldn’t load the flow to run (or to execute on_crashed hooks). In Git, exit code 255 almost always points to an auth/permission or network/connectivity problem rather than a Prefect bug. Most common root causes - Private repo with no credentials available to the worker/runner - Token present but missing scopes or SSO not authorized - Wrong URL/branch/ref or the repo doesn’t exist - Corporate proxy/VPC blocking outbound to github.com:443 - Private submodules without propagated credentials What to check first - Is https://github.com/aidevakasha/outlet.git private? Can you clone it from the same environment/image that runs your worker? - Are you specifying credentials in your deployment (Prefect 3.x) via
flow.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:
Copy code
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):
Copy code
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):
Copy code
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
Copy code
git clone <https://github.com/aidevakasha/outlet.git>
or with a token:
Copy code
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.
p
@Marvin why i still got git clone issue? async def google_maps_deployment(github_repo: GitRepository): gmaps_flow = await flow.from_source( source=github_repo, entrypoint="workflows/flows/google_maps_outlet_scrape_flow.py:scrape_google_maps_flow", ) await 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 = await flow.from_source( source=github_repo, entrypoint="workflows/deployments/google_maps_scrape.py:run_flow_with_params", ) await 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__": from pathlib import Path from loguru import logger import asyncio from prefect_github import GitHubCredentials async def main(): root_path = Path(file).parent.parent github_url = "https://github.com/aidevakasha/outlet.git" github_credentials_block = await GitHubCredentials.load("github-creds") logger.debug( f"Loaded GitHub credentials: {github_credentials_block.token.get_secret_value()}" ) logger.info(f"Deploying {root_path / 'workflows'}") try: logger.info("Starting deployment...") logger.info(f"Deploying from GitHub repository: {github_url}") github_repo = GitRepository( url=github_url, credentials=github_credentials_block, branch="staging", _# pull_interval=None,_ ) await google_maps_deployment(github_repo) logger.success("Deployment complete.") except Exception as e: logger.error(f"Deployment failed: {e}") asyncio.run(main())
m
thought for 251.0 seconds
A few likely culprits jump out from your snippet. The most common one here: - Your repo URL is wrapped in Slack-style angle brackets. In code it must be a plain string, not
<https://...>
. Use:
Copy code
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):
Copy code
pip install "prefect-github"
- Make sure you’re importing the right class:
Copy code
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:
Copy code
# 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:
Copy code
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.