HI! How to use github repository in Prefect 2.0? I...
# ask-community
m
HI! How to use github repository in Prefect 2.0? I have already created a block github storage, but I can't figure out how to select branches and files in the repository? In version 1.0 it looked like this: from prefect.storage import Git
Copy code
flow.storage = Git(git_token_secret_name="github",
                   repo="repo/etl", 
                   repo_host="<http://github.com|github.com>",
                   branch_name=branch,
                   flow_path="flow/{}.py".format(flow_name))
j
Hi Mike, if you're on the latest version of prefect you can run
prefect deploy PATH_TO_FLOW:FLOW_NAME
in the cli from the root of your repo and you'll be guided through deploying your flow and setting up github storage. (Obviously switch PATH_TO_FLOW to the path to your flow and FLOW_NAME to your flow's name!)
m
Is there a way to do this using a python script?
Our script picks up changes from the github and then registration them using KubernetesRun. I would like to continue using it in the new version of Prefect (of course, first changing everything to fit the new realities)
j
You can use python but it's a bit more involved: https://docs.prefect.io/2.10.15/concepts/deployments/#create-a-deployment-from-a-python-object Not sure if it helps but the cli method creates a YAML file for you.
Keep watching the docs/the release notes though as we do hope to create a simpler python based deployment experience.