Where does prefect pull the code to when using `pr...
# ask-community
i
Where does prefect pull the code to when using `prefect-github`` ? @Marvin
m
Could you please specify the version of Prefect you are using? If you're unsure, I can provide guidance for both Prefect 2.x and 3.x.
i
I am using prefect
2.18.3
@Marvin
m
In Prefect 2.x, when using
prefect-github
to pull code from a GitHub repository, the code is pulled to the local environment where the Prefect agent is running. The agent then executes the flow using this local copy of the repository. To set this up, you need to use the
GitHubCredentials
block to authenticate and pull code. Here's a brief overview of how you can set it up: 1. Install the Prefect GitHub integration:
Copy code
pip install prefect-github
2. Register the block types:
Copy code
prefect block register -m prefect_github
3. Create a
GitHubCredentials
block:
Copy code
python
   from prefect_github import GitHubCredentials

   github_credentials_block = GitHubCredentials(token="YOUR_TOKEN")
   github_credentials_block.save(name="my-github-credentials-block")
4. Set repository details in your deployment to pull code:
Copy code
yaml
   pull:
     - prefect.deployments.steps.git_clone:
         repository: <https://github.com/org/my-private-repo.git>
         credentials: "{{ prefect.blocks.github-credentials.my-block-name }}"
For more detailed steps, you can refer to the Prefect GitHub Integration Documentation.