<@ULVA73B9P> Can I use GitHubCredentials with flow...
# ask-marvin
y
@Marvin Can I use GitHubCredentials with flow.from_source?
m
Yes, you can use
GitHubCredentials
with
flow.from_source
. Here's an example of how to use it:
Copy code
python
from prefect import flow
from prefect_github import GitHubCredentials

if __name__ == "__main__":
    flow.from_source(
        source=GitRepository(
            url="<https://github.com/org/private-repo.git>",
            credentials=GitHubCredentials.load("my-github-credentials-block")
        ),
        entrypoint="my_file.py:my_flow",
    ).deploy(
        name="private-github-deploy",
        work_pool_name="my_pool",
        build=False
    )
Alternatively, if you use a
prefect.yaml
file to create the deployment, you can reference the GitHub Credentials block in the pull step:
Copy code
yaml
pull:
  - prefect.deployments.steps.git_clone:
      repository: "<https://github.com/org/repo.git>"
      credentials: "{{ prefect.blocks.github-credentials.my-github-credentials-block }}"
For more details, consult the Prefect GitHub Integration Documentation.